Page 1 of 1

How do I create an 8" x 3.5" box?

Posted: 2011-01-10T12:32:51-07:00
by aLabelMaker
Is there a way to specify the dimensions of an image using inches and not pixels? Seems too confusing to convert pixels to inches.
This is the first step in creating a label.
Thanks!

Re: How do I create an 8" x 3.5" box?

Posted: 2011-01-10T12:51:06-07:00
by Bonzo
I would say not.
The thing is that everything else you do in Imagemagick will be in pixels anyway so how would you work around that ?

Code: Select all

convert -density 75 -size 600x263 xc:black test_density.jpg

Re: How do I create an 8" x 3.5" box?

Posted: 2011-01-10T14:21:43-07:00
by aLabelMaker
yeah, that makes sense. So, how then would I make the dimensions so that they would equal 8" x 3.5"?
Getting this specific dimension is primary to starting my project as this will be the label size required. I've read that the pixel to inches conversion will be different depending on the dpi(dots per sq inch). Do you know a way to get clarity on this?

Re: How do I create an 8" x 3.5" box?

Posted: 2011-01-10T14:26:36-07:00
by Bonzo
My example code above gives a box of 8"x 3.507"

Set the DPI using -density - I think it needs defining before the size - then the size in pixels.

8" * 75dpi = 600px
3.5" * 75dpi = 262.5px

Re: How do I create an 8" x 3.5" box?

Posted: 2011-01-10T15:02:45-07:00
by aLabelMaker
that looks great. I'm trying to draw a black outline around the inside of the box using the draw command. Here is what I came up with and it is telling me "unable to open image" and "no decode delegate for this image format".

convert -density 75 -size 600x263 xc:white -fill white -stroke black \ -draw "rectangle 590x253" draw_rect.jpg

I think that my rectangle dimensions are not in the right format?

Re: How do I create an 8" x 3.5" box?

Posted: 2011-01-10T15:20:43-07:00
by Bonzo
How are you using your code php, batch, bash etc?

Code: Select all

convert -density 75 -size 600x263 xc:white -fill white -stroke black -strokewidth 10 -draw "rectangle 50,50 550,213" draw_rect.jpg
You need to check out my site as I have links to most of the operators under the basics section or the IM example section: http://www.imagemagick.org/Usage/

Re: How do I create an 8" x 3.5" box?

Posted: 2011-01-10T16:27:49-07:00
by fmw42
Inches are printing units and depend upon the density or resolution you set. So you need to set the density and then figure out how many pixels on a side that would correspond to. IM does not use drawing units of inches only pixels to my knowledge.

Re: How do I create an 8" x 3.5" box?

Posted: 2011-01-11T19:05:01-07:00
by aLabelMaker
I am using the bash shell.

Re: How do I create an 8" x 3.5" box?

Posted: 2011-01-11T19:49:09-07:00
by fmw42
-draw "rectangle 590x253" should be -draw "rectangle ULX,ULY BRX,BRY"

that is you must tell the draw commands the upperleft and bottomright coordinates and not the WIDTHxHEIGHT

see http://www.imagemagick.org/Usage/draw/#primitives

see Bonzo's command above. That should work in a bash shell as it is just one command line or it can be run from PHP exec command.