<t>Hello<br/>
<br/>
I have joined the ImageMagick discourse today – hello everybody.<br/>
<br/>
I make screenshots of line graphics, trim them with ImageMagick and paste them into a Word document.<br/>
I would like to set the density to get the desired width in centimeters without changing the size in pixels. This means that I will set meta data without touching the pixels.<br/>
Is there a single-line command line that reads the width and calculates the density? Something like this to get a width of 7.7cm:<br/>
<br/>
magick convert clipboard: -units PixelsPerCentimeter -density '(%w/7.7)' clipboard:<br/>
<br/>
How do I have to write it correctly?<br/>
<br/>
I have found other posts, but I have not found any single-line examples.<br/><br/>
Thanks in advance.<br/>
stringeater<br/><br/>
Version: 7.0.8-11 Q16 x86 2018-09-29 / Windows 10</t>
Command line: set density to get cm without resizing
-
- Posts: 4
- Joined: 2018-09-24T07:35:37-07:00
- Authentication code: 1152
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Command line: set density to get cm without resizing
I do not know much about clipboard: but I think the correct syntax for the density would be '%[fx:w/7.7]'
Computations cannot be done with string formats such as %w. But they can be done in fx expressions as above.
If you want to add style use the buttons above the editing window rather than adding HTML code.
Computations cannot be done with string formats such as %w. But they can be done in fx expressions as above.
If you want to add style use the buttons above the editing window rather than adding HTML code.
-
- Posts: 4
- Joined: 2018-09-24T07:35:37-07:00
- Authentication code: 1152
Re: Command line: set density to get cm without resizing
Hi fmw42
Thanks for your extremely quick reply.
Unfortunately I get the error message:
convert: Invalid Argument '-density': '%[fx:w/7.7]' @ error/convert.c/ConvertImageCommand/1309.
My complete command line was:
magick convert clipboard: -units PixelsPerCentimeter -density '%[fx:w/7.7]' clipboard:
Using clipboard: seems not to be a problem. The following command line works well:
magick convert clipboard: -units PixelsPerCentimeter -density 100 clipboard:
What was wrong with my command line?
Regards, stringeater
Thanks for your extremely quick reply.
Unfortunately I get the error message:
convert: Invalid Argument '-density': '%[fx:w/7.7]' @ error/convert.c/ConvertImageCommand/1309.
My complete command line was:
magick convert clipboard: -units PixelsPerCentimeter -density '%[fx:w/7.7]' clipboard:
Using clipboard: seems not to be a problem. The following command line works well:
magick convert clipboard: -units PixelsPerCentimeter -density 100 clipboard:
What was wrong with my command line?
Regards, stringeater
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Command line: set density to get cm without resizing
Use just "magick", not "magick convert".
Using "magick convert" gives you v6 syntax, which doesn't allow expressions in "-density". V7 syntax does.
Using "magick convert" gives you v6 syntax, which doesn't allow expressions in "-density". V7 syntax does.
snibgo's IM pages: im.snibgo.com
-
- Posts: 4
- Joined: 2018-09-24T07:35:37-07:00
- Authentication code: 1152
Re: Command line: set density to get cm without resizing
snibgo, thanks for this remark. I would have tried endlessly.
I had to remove the apostrophs to avoid another error message. This command line finally worked:
magick clipboard: -units PixelsPerCentimeter -density %[fx:w/7.7] clipboard:
Thank you fmw42 and snibgo! You have been very helpful
Regards, stringeater
I had to remove the apostrophs to avoid another error message. This command line finally worked:
magick clipboard: -units PixelsPerCentimeter -density %[fx:w/7.7] clipboard:
Thank you fmw42 and snibgo! You have been very helpful
Regards, stringeater
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Command line: set density to get cm without resizing
Windows can work without quotes, but in Unix, the quotes are needed. I think double quotes will work in Windows, but I will defer to Windows experts on that issue.
For other differences, see https://imagemagick.org/Usage/windows/
For other differences, see https://imagemagick.org/Usage/windows/
-
- Posts: 4
- Joined: 2018-09-24T07:35:37-07:00
- Authentication code: 1152
Re: Command line: set density to get cm without resizing
Yes, double qoutes work, but not single apostrophs.
Thanks for the link to a lot of information.
Thanks for the link to a lot of information.