Skip to main content

ADOBE Profiles (U.S. Web Coated (SWOP) v2) to sRGB, it's possible?

2 replies [Last post]
jmcodinach
Offline
Joined: 2009-05-14
Points: 0

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Adam Augusta

Hi Joseph,

I think you'll find JAI support for color conversion to be inadequate.
I ended up using JNA to access the Little CMS library.

I used a RectIter to loop through the source image (PlanarImage).
final RectIter rectIter = RectIterFactory.create(srcImage, null);

Filled a byte array with each row. Used LCMS to convert. Packed the
result into an interleaved raster.

Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height,
targetBands, new Point(0, 0));

Created a ComponentColorModel object. Created a BufferedImage using
the ColorModel and the Raster. Got a PlanarImage out by using
PlanarImage#wrapRenderedImage.

It's possibly the most heinous code I've ever written, but it works well.

-Adam

On Thu, May 14, 2009 at 5:46 AM, wrote:
> Hello every one,
> It’s possible convert a .jpg file with an ICCProfile = U.S. Web Coated (SWOP) v2 to any other profile compatible with IE6,  like sRGB IEC61966-2.1.
> A hundreds of thanks in advance,
> Any suggestion is very appreciate and many thanks in advance,
> Joseph from Barcelona
>
> Here's the full data returned by http://regex.info/exif.cgi  (very recommended site)
> XMP — this group of metadata is encoded in 14,695 bytes (14.4k)
> Color Mode      4
> Color Space     Unknown (-1)
> Create Date     2008:12:11 12:56:22+01:00
> 5 months, 2 days, 22 hours, 24 minutes, 19 seconds ago
> Creator Tool    Adobe Photoshop CS2 Windows
> Document ID     adobe:docid:photoshop:f7e4e197-df50-11da-a2f9-bae20e79defc
> Format  image/jpeg
> History
> ICC Profile Name        U.S. Web Coated (SWOP) v2
> Instance ID     uuid:79B6137E44FED511AE47C13B11BEA4E9
> Metadata Date   2002:01:01 00:23:52+01:00
> 7 years, 4 months, 13 days, 10 hours, 56 minutes, 49 seconds ago
> Modify Date     2002:01:01 00:23:52+01:00
> 7 years, 4 months, 13 days, 10 hours, 56 minutes, 49 seconds ago
> Native Digest   256, 257, 258, 259, 262, 274, 277, 284, 530, 531, 282, 283, 296, 301, 318, 319, 529, 532, 306, 270, 271, 272, 305, 315, 33432;9B7DB1A81C58DE41161C7D274985848A
> Native Digest   36864, 40960, 40961, 37121, 37122, 40962, 40963, 37510, 40964, 36867, 36868, 33434, 33437, 34850, 34852, 34855, 34856, 37377, 37378, 37379, 37380, 37381, 37382, 37383, 37384, 37385, 37386, 37396, 41483, 41484, 41486, 41487, 41488, 41492, 41493, 41495, 41728, 41729, 41730, 41985, 41986, 41987, 41988, 41989, 41990, 41991, 41992, 41993, 41994, 41995, 41996, 42016, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 23, 24, 25, 26, 27, 28, 30;E9644A79BB4368BC6BAF09F94580B34C
> XMP     (14,695 bytes binary data)
> XMP Toolkit     3.1.1-111
> EXIF — this group of metadata is encoded in 5,763 bytes (5.6k)
> Color Space     Uncalibrated
> Compression     JPEG (old-style)
> Exif Image Size 400 × 363
> Modify Date     2002:01:01 00:23:52
> 7 years, 4 months, 13 days, 1 hour, 56 minutes, 49 seconds ago
> Orientation     Horizontal (normal)
> Resolution      300 pixels/inch
> Software        Adobe Photoshop CS2 Windows
> Thumbnail Length        5,461
> X Resolution    72
> Y Resolution    72
> Photoshop
> Color Halftoning Info   (72 bytes binary data)
> Color Transfer Funcs    (112 bytes binary data)
> Copyright Flag  False
> Displayed Units X       inches
> Displayed Units Y       inches
> Global Altitude 30
> Global Angle    30
> Grid Guides Info        (16 bytes binary data)
> ID's Base Value (4 bytes binary data)
> IPTC Digest     460cf28926b856dab09c01a1b0a79077
> Macintosh Print Info    (120 bytes binary data)
> Photoshop Format        Standard
> Photoshop Quality       8
> Photoshop Thumbnail     (5,461 bytes binary data)
> Photoshop 0x042f        (60 bytes binary data)
> Pixel Aspect Ratio      (12 bytes binary data)
> Print Flags     (9 bytes binary data)
> Print Flags Info        (10 bytes binary data)
> Print Scale     (14 bytes binary data)
> Progressive Scans       3 Scans
> Slices  (865 bytes binary data)
> URL List        (4 bytes binary data)
> Version Info    Adobe Photoshop
> Adobe Photoshop CS2
> X Resolution    300
> Y Resolution    300
> APP14
> APP14 Flags 0   (none)
> APP14 Flags 1   (none)
> Color Transform YCCK
> DCT Encode Version      100
> IPTC
> Application Record Version      2
> File — basic information derived from the file.
> Bits Per Sample 8
> Color Components        4
> Current IPTC Digest     460cf28926b856dab09c01a1b0a79077
> Encoding Process        Baseline DCT, Huffman coding
> Exif Byte Order Big-endian (Motorola, MM)
> File Size       597 kB
> File Type       JPEG
> Image Size      400 × 363
> MIME Type       image/jpeg
> Composite
> This block of data is computed based upon other items. Some of it may be wildly incorrect if the image has been resized.
> Thumbnail Image (5,461 bytes binary data)
> ICC_Profile — this group of metadata is encoded in 557,168 bytes (544.1k)
> A To B0 (41,478 bytes binary data)
> A To B1 (41,478 bytes binary data)
> A To B2 (41,478 bytes binary data)
> B To A0 (145,588 bytes binary data)
> B To A1 (145,588 bytes binary data)
> B To A2 (145,588 bytes binary data)
> CMM Flags       Not Embedded, Independent
> Color Space Data        CMYK
> Connection Space Illuminant     0.9642 1 0.82491
> Device Attributes       Reflective, Glossy, Positive, Color
> Device Manufacturer     ADBE
> Device Model
> Gamut   (37,009 bytes binary data)
> Media White Point       0.7084 0.73595 0.57104
> Primary Platform        Apple Computer Inc.
> Profile CMM Type        ADBE
> Profile Class   Output Device Profile
> Profile Connection Space        Lab
> Profile Copyright       Copyright 2000 Adobe Systems, Inc.%00
> Profile Creator ADBE
> Profile Date Time       2000:07:26 05:41:53
> 8 years, 9 months, 18 days, 20 hours, 38 minutes, 48 seconds ago
> Profile Description     U.S. Web Coated (SWOP) v2
> Profile File Signature  acsp
> Profile ID      0
> Profile Version 2.1.0
> Rendering Intent        Media-Relative Colorimetric
> [Message sent by forum member 'jmcodinach' (jmcodinach)]
>
> http://forums.java.net/jive/thread.jspa?messageID=346235
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

jonasfleer
Offline
Joined: 2007-11-21
Points: 0

Hello Joseph,

i implemented the same some days ago and i think the right way is to do it with the "ColorConvert" operation, but i had no luck with it. So i implemented it as a Java2D filter (RGBImageFilter):

// Load color space for CMYK profile
ICC_Profile iccProfileUSWebCoatedSWOP;
InputStream s =
getClass().getClassLoader().getResourceAsStream("USWebCoatedSWOP.icc");
iccProfileUSWebCoatedSWOP = ICC_Profile.getInstance(s);
ColorSpace csUSWebCoatedSWOP = new ICC_ColorSpace(iccProfileUSWebCoatedSWOP);

...

@Override
public final int filterRGB(int x, int y, int rgb) {
// Current value is packed in a single integer.
int[] value = new int[] {
((rgb >> 16) & 0xff), // Red
((rgb >> 8) & 0xff), // Green
(rgb & 0xff), // Blue
((rgb >> 24) & 0xff), // Alpha
};

float[] d = new float[] {value[0]/255f, value[1]/255f, value[2]/255f};
float[] cymk = colorSpace.fromRGB(d);
float[] d2 = colorSpace.toRGB(cymk);
value[0] = Math.round(d2[0] * 255);
value[1] = Math.round(d2[1] * 255);
value[2] = Math.round(d2[2] * 255);

// Re-combine values to a 4-channel integer.
return ((value[3] & 0xFF) << 24) |
((value[0] & 0xFF) << 16) | ((value[1] & 0xFF) << 8) |
((value[2] & 0xFF) << 0);
}

I copied the source together, so it might have some quirks, but you should get the idea. The icc file is the ICC profile file.
If you implement it as a ColorConvert operation, i would appreciate a hint how to do it. ;)

Greetings from Berlin

Jonas