Is it possible? - The same input and output filename?
Is it possible? - The same input and output filename?
I couldn't find how to do that. I need to convert a lot of files and i need that filenames of converted files was the same that the file from which it was converted. Is it possible?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is it possible? - The same input and output filename?
convert image1name .....options.... image1name
This will overwrite the original with all the processing done by the options and keep the same input name. If you want another name just use that for the output. But if you use the same name, the result will write over the input.
This will overwrite the original with all the processing done by the options and keep the same input name. If you want another name just use that for the output. But if you use the same name, the result will write over the input.
Re: Is it possible? - The same input and output filename?
Don't forget the mogrify program. It can perform inline image processing and replacement.
Re: Is it possible? - The same input and output filename?
Yes, thanks. Mogrify was what i need....i was searching for some hours thru the convert's manuals, that's wy i didn't find anything
Re: Is it possible? - The same input and output filename?
<grrr> ... There really should be several references to mogrify in the convert's manual. ... I only searched for about forty-five minutes but it wasn't until I came across this post that I was able to start looking in the right direction.Axolotl wrote:Yes, thanks. Mogrify was what i need....i was searching for some hours thru the convert's manuals, that's wy i didn't find anything :D
For the benefit of others this line did exactly what I needed. It took about fifty 2meg to 3meg JPGs (in the same directory) and dropped them all down to 80 to 120 kb. And of course it left all of their names 'exactly' the same.
Code: Select all
mogrify *.jpg -quality 75 -resize "640x480>" *
*.jpg ... performs the mogrify command on all JPGs in the directory.
-quality 75 ... cuts the jpg quality down to 75% which is plenty for online viewing.
-resize "640x480>" ... causes all of the images to be resized to 640x480 (notice the ">" at the end. That makes images smaller but 'not' larger. ... and don't forget the quotes; those are important.
* ... and don't forget this at the very end of the command :-)
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Is it possible? - The same input and output filename?
That is BAD! You are not just mogrifyign each JOG you are doing so twice, plus any other image you have in the current directory!!!!tg3793 wrote:Axolotl wrote:Code: Select all
mogrify *.jpg -quality 75 -resize "640x480>" *
Mogrify should only list the file names to modify once, at the end.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Is it possible? - The same input and output filename?
Ok, I got that string from another site and it worked so I was pretty excited about.
I'll try to fool with that a bit next time I need to use it for any reason.
I'll try to fool with that a bit next time I need to use it for any reason.