OK - I grabbed an updated copy from CodeCentral, created a test program
to verify that I could now read the file. I can, but the colors show up
"funny". For example, there's a section that appears brown when opened
with the Windows Picture Viewer. Shows up in my program as a dark wine
red.
Anybody have any suggestions on why that might happen? Alternately, if
this is a known issue, is there another library that I might try that
implements CMYK-reading for JPEG?
Thanks.
You need a color management engine to handle CMYK files properly.
Try Little CMS : http://www.littlecms.com/
It's free and includes source code.
Nils
"Trond Grontoft" <tr...@tiger-removethis.no> schreef in bericht
news:45fa...@newsgroups.borland.com...
> You can convert CMYK to RGB with an easy formula, no need to install the
> CMS engine. The CMS engine is only important if the Jpeg defines a
> non-default color space, and embeds the accompanying CMS profile. Then
> again, I don't think Gabriel Corneanu's version will work with CMS at all.
I agree with Nils, although I don't know about CMS at all. You could find
the conversion code at http://www.efg2.com . I think that there must be an
easier solution about this, that is, save the CMYK JPEG to bitmap and then
save the converted bitmap back to JPEG again with MSPaint, Photoshop, etc. I
think that this is not a good idea for programmer, but it works indeed.
Best regards.
Xiaoguang
I'm a tad confused by these responses, I must admit.
I have a routine that now loads the JPEG in question. It looks OK to me when
displayed, unless I open the JPEG in MS Picture Viewer or something and then
I see that the colors don't match. But I don't know that for a given JPEG I
may have this problem, and my program is just supposed to display JPEGs.
So either the routine that I'm using isn't working correctly, at least for
some colors, or - well, I don't know what the "or" part is.
I'm not sure what help conversion code does me, unless it's to write my own
JPEG loader for CMYK files.
Alternately, I'm open to an alternate library for opening JPEGs that include
CMYK support...
Thanks.
> Alternately, I'm open to an alternate library for opening JPEGs that include
> CMYK support...
You could try using ImageEn at:
http://www.hicomponents.com/nimageen.asp
Very good and can read jpegs with CMYK.
Kind Regards
Roy Magne Klever
I am quite busy these days, and do not have too much time to watch the newsgroups...
As others said, I didn't do too much special to support the CMYK. It basically means:
- decode the jpeg in a 32bpp bitmap (Delphi source was faulty using 24bpp)
- run each scan line through a conversion routine
If you look at the interface file and sample application, you see that there is a property "AutoCMYKToRGB" and a function "BitmapCMYKToRGB".
Set this property to false and get the raw CMYK data in a 32bpp bitmap. Then run the bitmap through your own conversion routine.
Hope it helps.
Regards,
Gabriel