ImageMagick inches cm

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sashs
Posts: 6
Joined: 2010-04-12T23:50:31-07:00
Authentication code: 8675308

ImageMagick inches cm

Post by sashs »

Hello,

is it possible to resize an image, if i only have the size in inches or centimetres?

Regards

sashs
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick inches cm

Post by snibgo »

As far as I know, IM has no options to directly resize in inches or centimetres. You need to do the calculations in a script.
snibgo's IM pages: im.snibgo.com
sashs
Posts: 6
Joined: 2010-04-12T23:50:31-07:00
Authentication code: 8675308

Re: ImageMagick inches cm

Post by sashs »

Thanx.
My knowing about graphic processing is not good. Could you give me a little example for this?

Regards

sashs
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImageMagick inches cm

Post by Bonzo »

How are you running the IM commands ? Linux, Windows, php etc.
sashs
Posts: 6
Joined: 2010-04-12T23:50:31-07:00
Authentication code: 8675308

Re: ImageMagick inches cm

Post by sashs »

I run IM on Windows. I do all with Java, but with system-commands (command-line).

Regards

sashs

EDIT: I don't use JMagick.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick inches cm

Post by snibgo »

set INFILE=liquid.jpg
set OUTFILE=liquid_resized.jpg
set MAX_HEIGHT_INCHES=3
set MAX_WIDTH_INCHES=5

FOR /F "usebackq" %%i IN (`identify -format "MAX_WIDTH_PIXELS=%%[fx:resolution.x*%MAX_WIDTH_INCHES%]\nMAX_HEIGHT_PIXELS=%%[fx:resolution.y*%MAX_HEIGHT_INCHES%]" %INFILE%`) DO @set %%i

convert %INFILE% -resize %MAX_WIDTH_PIXELS%x%MAX_HEIGHT_PIXELS% %OUTFILE%
snibgo's IM pages: im.snibgo.com
sashs
Posts: 6
Joined: 2010-04-12T23:50:31-07:00
Authentication code: 8675308

Re: ImageMagick inches cm

Post by sashs »

Thanx. It was very helpful.

Regards

sashs
Post Reply