FROM : David Masters
DATE : Sat Jul 08 00:05:51 2006
Michael,
On 7 Jul 2006, at 21:54, Michael B. Johnson wrote:
> I'm trying to use sips to turn some 200dpi full rez images into 72
> dpi thumbnails (because of a bug in the NSImageCell), and this
>
> sips -s format jpeg -s formatOptions normal src.jpg --resampleWidth
> 256 -s dpiHeight 72.0 -s dpiWidth 72.0 --out dst.jpg
>
> yields a 256 wide 200 dpi (if that was the source image's dpi).
>
> Anybody see what I'm missing?
Not entirely sure, but I think the problem lies with some of the
additional metadata in the JPEG file.
I ran into something similar before: I opened up .jpg files (saved
from Photoshop) in Preview, and then used Tools -> Get Info ->
Details to see what was in the metadata. The relevant information
looks something like this:
File Name src.jpg
DPI Height 200
DPI Width 200
Pixel Height 600
Pixel Width 800
Exif Properties
Pixel X Dimension 800
Pixel Y Dimension 600
JFIF Properties
X Density 200
Y Density 200
TIFF Properties
X Resolution 200
Y Resolution 200
When you run...
sips -s format jpeg -s formatOptions normal src.jpg --resampleWidth
256 -s dpiHeight 72.0 -s dpiWidth 72.0 --out dst.jpg
...this only appears to change the JFIF Properties X and Y Density -
as you would expect for a JPEG file. However, other applications read
the other Properties so Photoshop and Preview think it is 200dpi, but
GraphicConverter, for example, thinks it is 72 dpi.
Probably the best solution is to somehow remove the additional
metadata, but one workaround is to convert to an intermediate format...
sips -s format png -s formatOptions normal src.jpg --resampleWidth
256 -s dpiHeight 72.0 -s dpiWidth 72.0 --out intermediate.png
...and then convert to jpg...
sips -s format jpeg intermediate.png --out dst.jpg
One slight annoyance (apart from having to do two steps) is that the
conversion from the png format's of 2835 pixels per metre(!) results
in 72.00901 dpi being reported in some applications for the JPEG
resolution. Possibly a different intermediate format would work better.
Hope this helps!
David
David Masters, Software Imagineer
<email_removed>
Web: http://www.pyrusmalus.com Tel: +44 141 427 9649 Fax: +44
141 427 1740
P y r u s M a l u s | d e s i g n | d e v e l o p | d e l
i v e r | c o n s u l t | t r a i n | s u p p o r t |
DATE : Sat Jul 08 00:05:51 2006
Michael,
On 7 Jul 2006, at 21:54, Michael B. Johnson wrote:
> I'm trying to use sips to turn some 200dpi full rez images into 72
> dpi thumbnails (because of a bug in the NSImageCell), and this
>
> sips -s format jpeg -s formatOptions normal src.jpg --resampleWidth
> 256 -s dpiHeight 72.0 -s dpiWidth 72.0 --out dst.jpg
>
> yields a 256 wide 200 dpi (if that was the source image's dpi).
>
> Anybody see what I'm missing?
Not entirely sure, but I think the problem lies with some of the
additional metadata in the JPEG file.
I ran into something similar before: I opened up .jpg files (saved
from Photoshop) in Preview, and then used Tools -> Get Info ->
Details to see what was in the metadata. The relevant information
looks something like this:
File Name src.jpg
DPI Height 200
DPI Width 200
Pixel Height 600
Pixel Width 800
Exif Properties
Pixel X Dimension 800
Pixel Y Dimension 600
JFIF Properties
X Density 200
Y Density 200
TIFF Properties
X Resolution 200
Y Resolution 200
When you run...
sips -s format jpeg -s formatOptions normal src.jpg --resampleWidth
256 -s dpiHeight 72.0 -s dpiWidth 72.0 --out dst.jpg
...this only appears to change the JFIF Properties X and Y Density -
as you would expect for a JPEG file. However, other applications read
the other Properties so Photoshop and Preview think it is 200dpi, but
GraphicConverter, for example, thinks it is 72 dpi.
Probably the best solution is to somehow remove the additional
metadata, but one workaround is to convert to an intermediate format...
sips -s format png -s formatOptions normal src.jpg --resampleWidth
256 -s dpiHeight 72.0 -s dpiWidth 72.0 --out intermediate.png
...and then convert to jpg...
sips -s format jpeg intermediate.png --out dst.jpg
One slight annoyance (apart from having to do two steps) is that the
conversion from the png format's of 2835 pixels per metre(!) results
in 72.00901 dpi being reported in some applications for the JPEG
resolution. Possibly a different intermediate format would work better.
Hope this helps!
David
David Masters, Software Imagineer
<email_removed>
Web: http://www.pyrusmalus.com Tel: +44 141 427 9649 Fax: +44
141 427 1740
P y r u s M a l u s | d e s i g n | d e v e l o p | d e l
i v e r | c o n s u l t | t r a i n | s u p p o r t |
| Related mails | Author | Date |
|---|---|---|
| Michael B. Johnson | Jul 7, 22:54 | |
| David Masters | Jul 8, 00:05 | |
| János | Jul 8, 01:54 |






Cocoa mail archive

