Converting jpg's to tiffs...
Posted: 2007-03-01T14:14:20-07:00
I'm reading in JPGs, and writing them out as tiff files. I am doing some other modifications in between (rotation, cropping, etc), though I have the same problem even if those are commented out.
This is the relevant code. The printshop people are asking for tiff's that have 300x300 dpi, and are 8bitdepth (without that, they seemed to default to 16bit). When they try to open the tiffs in Photoshop, they get two warning messages, one after another.
The first just has an ok button:
The second allows you to cancel or continue:
Now, if someone has uploaded a PNG or BMP, the resulting TIFF files are ok. But 98% of what we get will be jpg. Also, I think this is at least related to another problem I mentioned earlier, about what was only a warning message. This message only happens with jpg's, and is:
Whenever this message occurs, Photoshop seems to have trouble with the TIFFs (they can be opened, but they still have alot of pre-processing to do before this, I need to get rid of the warnings) whenever I get this message. It's not even clear that I'm getting the RGB -> CMYK conversion correctly... it's an improvement over what I had, but the colors seem to be slightly over-saturated, if correct.
Finally, another thing I've noticed... problem tiff's cannot be opened by Mac OSX's Preview utility. It just barfs and dies, and you can't see thumbnails of them in finder. For that matter, GIMP doesn't bat an eyelash (even though it has the same over-saturation issue, which photoshop doesn't have that problem, once you've clicked through the warnings).
Code: Select all
$image->Read($upload->tempname);
my ($w, $h) = $image->Get('width','height');
if ($w < $h) { $image->Rotate(degrees=>90); }
$rotated = $image->Clone();
$image->Profile(profile=> $c->config->{filestore} .'/art/composite/USWebCoatedSWOP.icc');
$image->Set(depth=>8);
$image->Set(density=>'300x300');
$image->Crop(geometry=>'1088x713+0+0');
$image->Set(colorspace=>'CMYK');
$image->Write(magick=>'TIFF', filename=>$name);
The first just has an ok button:
This file contains file info data which cannot be read and has been ignored.
The second allows you to cancel or continue:
The embedded ICC profile cannot be used because the ICC profile is invalid. Ignoring the profile.
Now, if someone has uploaded a PNG or BMP, the resulting TIFF files are ok. But 98% of what we get will be jpg. Also, I think this is at least related to another problem I mentioned earlier, about what was only a warning message. This message only happens with jpg's, and is:
Exception 350: /data/art/temp/nHhwGTWk9R.tiff: Unknown pseudo-tag 65537. `TIFFSetField'
Whenever this message occurs, Photoshop seems to have trouble with the TIFFs (they can be opened, but they still have alot of pre-processing to do before this, I need to get rid of the warnings) whenever I get this message. It's not even clear that I'm getting the RGB -> CMYK conversion correctly... it's an improvement over what I had, but the colors seem to be slightly over-saturated, if correct.
Finally, another thing I've noticed... problem tiff's cannot be opened by Mac OSX's Preview utility. It just barfs and dies, and you can't see thumbnails of them in finder. For that matter, GIMP doesn't bat an eyelash (even though it has the same over-saturation issue, which photoshop doesn't have that problem, once you've clicked through the warnings).