TEST CASE #1:
Here is the same convert command being run on an input file (in.png). The only difference between the commands is the output file type. The output to TIFF and JPEG seems to do roughly what is expected. But the PNG output does nothing.
Code: Select all
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /in.png
convert -units PixelsPerInch /in.png /out.tiff
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.tiff
convert -units PixelsPerInch /in.png /out.jpeg
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.jpeg
convert -units PixelsPerInch /in.png /out.png
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.png
1. Change the existing unit from PixelsPerCentimeter to PixelsPerInch.
2. Convert the existing x and y resolution values to be proportional to the new unit.
3. Write the new unit and resolution into the output file headers.
ACTUAL RESULT:
The first 2 convert commands work fine (though the converted resolution is less accurate with the JPEG conversion).
The command that converts to a PNG does not do anything at all.
TEST CASE #2:
Here is a convert command that all 3 output file types do fine. Just for reference. Again, the only difference between these commands is the output file type. These all do what is expected.
Code: Select all
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /in.png
convert -density 72 /in.png /out.tiff
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.tiff
convert -density 72 /in.png /out.jpeg
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.jpeg
convert -density 72 /in.png /out.png
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.png
1. Replace the existing resolution X and Y headers with the new value (72).
2. Store the existing unit into the out, ignoring it completely.
ACTUAL RESULT:
Same as expected result.
TEST CASE #3:
Code: Select all
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /in.png
convert -units PixelsPerInch -density 72 /in.png /out.tiff
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.tiff
convert -units PixelsPerInch -density 72 /in.png /out.jpeg
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.jpeg
convert -units PixelsPerInch -density 72 /in.png /out.png
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.png
1. Replace the existing units (PixelsPerCentimeter) with the new unit (PixelsPerInch).
1. Replace the existing resolution X and Y headers (28.35) with the new value (72).
3. Perform NO conversions, just save those new values into the output file headers.
ACTUAL RESULT:
The first 2 convert commands work fine. But the one saving to a PNG does nothing. It just basically saves a copy of the existing file. But if you type the -unit option after the -density option instead of before you at least get the new resolution written into the output PNG, but the unit remains unchanged. So:
TEST CAST #4:
Code: Select all
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /in.png
convert -density 72 -units PixelsPerInch /in.png /out.png
identify -format "\n\n%f: %w by %h Pixels %x by %y\n\n" /out.png
Same as test case #3.
1. Replace the existing units (PixelsPerCentimeter) with the new unit (PixelsPerInch).
1. Replace the existing resolution X and Y headers (28.35) with the new value (72).
3. Perform NO conversions, just save those new values into the output file headers.
ACTUAL RESULT:
The units are not changed.
The only other thing I would add is that the formats should all perform the PixelsPerCentimeter to PixelsPerInch conversion with exactly the same accuracy in test case #1. It is an inaccurate conversion by nature (multiplying by about 0.3937007874015748), but the JPEG conversion should at least be doing it to the same number of decimal places as the TIFF (and as many decimal places as possible for both).
Thanks. Hope to hear back from you,
Mark