GDIPLUSX - how to remove CMYK colorspace from JPG

Topics: General, Attention VFPX Admins
Jan 28, 2008 at 10:01 PM
I've been using the pre-release GDIPLUSX classes quite successfully for image resizing and thumbnail creation. Occasionally I run in to JPGs coming through my little resizing system that has both RGB & CMYK colorspaces embedded. I want to remove the CMYK colorspace. I've seen some examples here how to create CMYK values but nothing that explicitly removes it. Any pointers would be appreciated. (And my other project is to start using the 1.1 version of the classes but I think I'll hack away at that on my own for a bit.)

Thanks,

RK
Jan 28, 2008 at 10:14 PM

rkaye wrote:
I've been using the pre-release GDIPLUSX classes quite successfully for image resizing and thumbnail creation. Occasionally I run in to JPGs coming through my little resizing system that has both RGB & CMYK colorspaces embedded. I want to remove the CMYK colorspace. I've seen some examples here how to create CMYK values but nothing that explicitly removes it. Any pointers would be appreciated. (And my other project is to start using the 1.1 version of the classes but I think I'll hack away at that on my own for a bit.)



And of course I ran a little test using an image that I knew had this particular issue and the result I sent out had removed the CMYK. So perhaps this has changed since the pre-release version I'm using?
Jan 29, 2008 at 3:17 AM
Hi RK,,

Can you upload some pictures and code samples showing what you are trying to do ?
Thanks in advance

Cesar
Jan 29, 2008 at 4:43 PM
Edited Jan 29, 2008 at 4:44 PM
Hi Cesar,

The code I'm using is pretty much based on the original resizing example but here's a snippet.

WITH _screen.system.drawing
<snip>
loResized=.Bitmap.New(m.lnWidth, m.lnHeight, .Imaging.PixelFormat.Format32bppARGB)
loResized.SetResolution(m.lnHorizontalDPI, m.lnVerticalDPI)
loGfx=.Graphics.FromImage(loResized)
  • Set some properties, to ensure to have a better quality of image
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.HighQuality
loGfx.InterpolationMode = .Drawing2D.InterpolationMode.HighQualityBicubic
  • Draw the source image on the new image at the desired dimensions
loGfx.DrawImage(loImage, 0, 0, m.lnWidth, m.lnHeight)
loResized.Save(m.lcTargetFile,.Imaging.ImageFormat.Jpeg)

I do have some sample JPGs but not sure how to upload here. The dimensions to resize to are specified by the user in the form UI. The other issue I'm now seeing when I use this particular code is that the colors after removing the CMYK colorspace are a bit washed out compared to the unaltered JPG.