Page 1 of 1

Convert - keep the resolution

Posted: 2010-02-02T18:10:40-07:00
by Albireo
Hi!

I have an "jpg" image with size: 600x600pixels, Resolution: 150 dpi
the image get rounded corners with the command. It's OK!
The final image is a ". gif" file (.jpg doesn't work)

The size is 120x120 - OK!
But I can't see the result resolution in IrfanView but the size is the same 120x120pixels

This command works for me (It's only the main code)

Code: Select all

FileIn = 61141_a.jpg
FileOut = 61141_a.gif
PicSize = 120x120     ; pic size out
RCPic = 15     ; rounded corner

%ImageMagick%\convert
		-define "jpeg:size=%PicSize%" %FileIn%
		-thumbnail "%PicSize%>"
		( +clone  -threshold -1
		-draw "fill black polygon 0,0 0,%RCPic% %RCPic%,0
		fill white circle %RCPic%,%RCPic% %RCPic%,0"
		( +clone -flip ) -compose Multiply -composite
		( +clone -flop ) -compose Multiply -composite )
		+matte -compose CopyOpacity -composite -background transparent
		-gravity center -compose Over -extent %PicSize% %FileOut%

Where can I put in this information without destroy something else?

Code: Select all

-density 30x30 -units pixelspercentimeter (or pixelsperinch)

Re: Convert - keep the resolution

Posted: 2010-02-02T19:28:34-07:00
by el_supremo
The GIF format does not include the resolution (density) of the image.

Pete

Re: Convert - keep the resolution

Posted: 2010-02-03T03:39:41-07:00
by Albireo
el_supremo wrote:The GIF format does not include the resolution (density) of the image.....
Hmmm. the GIF-images have an resolution or....?

I noticed a "strange" thing.
Created a png file instead of gif - the picture looked good (same size),
but IrfanView said that the image had a resolution of 2x2dpi ....

Can you use "-density 30x30 -units pixelspercentimeter " on png-files?
(and where to insert the instruction?)

//Jan

Re: Convert - keep the resolution

Posted: 2010-02-03T09:23:20-07:00
by el_supremo
Hmmm. the GIF-images have an resolution or....?
or nothing. There is no resolution information stored in a GIF image.
Can you use "-density 30x30 -units pixelspercentimeter " on png-files?
(and where to insert the instruction?)
Yes, PNG stores resolution information in pixels per centimetre. If you specify it in inches, IM will convert it.

I think you would specify it immediately before %FileOut%. You might have to specify the units first - "-units pixelspercentimeter -density 30x30 %FileOut%".

Pete

Re: Convert - keep the resolution

Posted: 2010-02-03T09:36:13-07:00
by Albireo
Thank you!
el_supremo wrote:..........I think you would specify it immediately before %FileOut%. You might have to specify the units first - "-units pixelspercentimeter -density 30x30 %FileOut%".
Pete
No :( , IrfanView shows still 2dpi x 2dpi
//jan

Re: Convert - keep the resolution

Posted: 2010-02-03T19:07:18-07:00
by el_supremo
No :( , IrfanView shows still 2dpi x 2dpi
I don't know how that's happening.
I created a 30 ppcm image with this command:

Code: Select all

convert logo: -units pixelspercentimeter -density 30x30 logo_den.png
Paint Shop Pro reports that the image is indeed 30 ppcm. IrfanView reports that it is 76 dpi which is the correct conversion from ppcm to dpi.

Pete

Re: Convert - keep the resolution

Posted: 2010-02-06T14:19:53-07:00
by Albireo
Thank you!

I have used your example of a "simple" image.
This "trial" gave a resolution of 300x300dpi - the file size was: 26KB

Code: Select all

convert -define jpeg:size=120x120 7748790.jpg -thumbnail "120x120>" 774879_120.png
and if I add the "density information" to the command, was the resolution: 76x76dpi.

Code: Select all

convert -define jpeg:size=120x120 7748790.jpg -thumbnail "120x120>" -units pixelspercentimeter -density 30x30 774879_120.png
But the file size was still 26kB
- I would have expected that the file size would reduce with lower resolution....

//Jan

Re: Convert - keep the resolution

Posted: 2010-02-06T14:41:59-07:00
by fmw42
density has no bearing on the file size. it only controls how the pixels are converted to print to make the print larger or smaller in physical dimensions such as inches or centimeters

Re: Convert - keep the resolution

Posted: 2010-02-06T16:34:40-07:00
by Albireo
fmw42 wrote:density has no bearing on the file size. it only controls how the pixels are converted to print to make the print larger or smaller in physical dimensions such as inches or centimeters
hmmm. The print to the printer or the print on the screen?
Why don't use high density everywhere?

I have read somewhere that, the best resolution for the webpages is 72dpi
(if the image size don't increase - why don't use 300, 600 or 1200dpi on the images on webpages?)
The prints could be better from the website?

Have I been thinking wrong? :?

//Jan

Re: Convert - keep the resolution

Posted: 2010-02-06T16:46:48-07:00
by fmw42
density only affects hard copy print and not the display. the nominal density for images is 72 dpi, but that has no bearing on an image displayed or put on a web page. The only issue is the pixel width and height of the image. the number of pixels in width and the density then determine how many inches it will print to. For 1000 pixels at 72 dpi it will print only (1000/72=14) inches. For 1000 pixels at 300 dpi, it will print (1000/300=3.3) inches. But on the screen it will still be 1000 pixels wide and the physical size of the picture on your monitor will only depend only upon your display resolution. If you display is say 1000 x 760 in a 20 in monitor then an image of 1000 pixels wide will be 20 inches wide as your monitor has 1000 pixels that span 20 inches.