|
Hi,
Yes, that is the correct way. If printer
profile is adequate, you should see same colors on printer and screen.
For decodig, it hardly depends of the library
being used for JPEG. If you are using Tom
Lane's code (IJG), then is quite easy.
Something like that:
jpeg_start_decompress(&Decompressor);
ScanLineIn =
malloc(Decompressor.output_width * 3);
ScanLineOut =
malloc(Decompressor.output_width * 4);
while (Decompressor.output_scanline
< Decompressor.output_height) {
jpeg_read_scanlines(&Decompressor, &ScanLineIn, 1);
cmsDoTransform(hXForm, ScanLineIn, ScanLineOut,
Decompressor.output_width);
.. do whatsever with
CMYK data in ScanLineOut...
}
You can find sample code in jpegicc utility
as well.
Regards,
----- Original Message -----
Sent: Thursday, February 13, 2003 7:06
PM
Subject: [Lcms-user] Input and output
profiles, and JPEG
I'm pretty new to lcms (I've used it a little). I have the following
situation.
I have a color profile monitorProfile.icm that maps Lab
colors to RGB colors, and that profile is being used to create a particular
JPEG file "monitor.jpg" that is displayed on a monitor. I no longer have
access to the original Lab colors, just the profile and monitor.jpg.
Now, I want to print monitor.jpg., i.e. convert "monitor.jpg" to something
that can be printed, i.e. CMYK data, and I have a color profile
printerProfile.icm that I can use.
I've taken an example from the tutorial and modified it as shown below (the
only changes I've made are in blue and red):
#include "lcms.h"
int
main(void) {
cmsHPROFILE hInProfile,
hOutProfile; cmsHTRANSFORM
hTransform; int
i;
hInProfile =
cmsOpenProfileFromFile("monitorProfile.icm",
"r"); hOutProfile = cmsOpenProfileFromFile("printerProfile.icm",
"r");
hTransform =
cmsCreateTransform(hInProfile,
TYPE_RGB_8,
hOutProfile,
TYPE_CMYK_8,
INTENT_PERCEPTUAL, 0);
for (i=0; i <
AllScanlinesTilesOrWatseverBlocksYouUse; i++)
{
cmsDoTransform(hTransform,
YourInputBuffer,
YourOutputBuffer,
YourBuffersSizeInPixels);
}
cmsDeleteTransform(hTransform);
cmsCloseProfile(hInProfile);
cmsCloseProfile(hOutProfile);
return 0; }
Is this the correct way to achieve what I want? Also, I presume
I need to extract the RGB data from the JPEG file and create my own CMYK file
(i.e. lcms doesn't handle image file data extraction/creation).
Thanks,
Richard
|