Sorry for my English )
I have several jpg files
I need to make them the same size as the 1.png file.
I tried it
but I can't read the size of the picture 1.png in one line and pass it as a parameter ((
convert 1.png -set option:original '%wx%h' -delete 0 *.jpg -resize '%[original]' '%d'.png
Is it possible to solve this problem with just one line?
Thank!
make the size of the pictures the same as 1.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: make the size of the pictures the same as 1.png
You can only do that one line with -set option in IM 7. With IM 6, you need to get the size as a variable in one line and then use another line to apply the variable to -resize.
Always best to provide your IM version and platform, when asking questions here.
With IM 7, this works fine for me for one image.
For two (or more images), this works fine:
Always best to provide your IM version and platform, when asking questions here.
With IM 7, this works fine for me for one image.
Code: Select all
magick lena.png -set option:dims "%wx%h" barn.jpg -delete 0 -resize "%[dims]" out.jpg
Code: Select all
magick lena.png -set option:dims "%wx%h" barn.jpg monet2.jpg -delete 0 -resize "%[dims]" out_%d.jpg
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: make the size of the pictures the same as 1.png
You can resize all the "*.jpg" images to match either the width or height of "1.png" while maintaining their original aspect using a command like this...Nezar wrote: ↑2019-02-05T14:29:34-07:00I have several jpg files
I need to make them the same size as the 1.png file.
Is it possible to solve this problem with just one line?Code: Select all
convert 1.png -set option:original '%wx%h' -delete 0 *.jpg -resize '%[original]' '%d'.png
Code: Select all
convert *.jpg 1.png +distort SRT "%[fx:(u[-1].w-2)/s.w] 0" -delete -1 _ch%03d.png
To make the output images match the height of "1.png", change the w's in the FX expression to h's like this...
Code: Select all
convert *.jpg 1.png +distort SRT "%[fx:(u[-1].h-2)/s.h] 0" -delete -1 _ch%03d.png
Re: make the size of the pictures the same as 1.png
thank you very much!
happened!
happened!
Re: make the size of the pictures the same as 1.png
But can you somehow find out the name of the first file in the set * .jpg?
not to write 1.png manually, but to take it automatically.
not to write 1.png manually, but to take it automatically.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: make the size of the pictures the same as 1.png
I think what he wants is to get the name of the first image and use it with the output. But -set filename does not work with "%t", for which I think it should be allowed. So one cannot currently do that in one line. One would get the filename first with "%t" as a variable and then use it with your command to set the output filename.