Im using mogrifiy command in Ubuntu server 20.04 to make a bulk resize, but i will like to know if the use of this command modify the name of the images. Theres my command
mogrify -resize 600x400 '*.jpg'
No, it doesn't. If you want the results in a new directory called RESULTS, you can do mkdir RESULTS then mogrify -path RESULTS -resize 600x400 *.jpg if that's what you mean. – Mark Setchell
Related
Hi I want to create a video from list of images on ruby on rails. I have searched alot and all i found out was ffmeg, but i guess that's a command line tool. How do i create it using pure ruby on rails. Is there any gem or tutorial. Please Help.
Thanks to LordNeckbeard, i found this single command to convert images into video here ffmpeg
.
ffmpeg -framerate 1/3 -pattern_type glob -i '*.jpg' -c:v libx264 out.mp4
there are some gems that work as an interface between ruby and ffmpeg like https://github.com/streamio/streamio-ffmpeg.
There are some other few, try them out!
You can access command line through RoR.
result = %x[some command line call here]
What you would have to do is be sure you have the names path to your end result and confirm the return code from the command line call.
It seems like i will have to use commandline tool as i did'nt find any gem that does all this stuff for me.
install image magick
install ffmpeg
first convert all the jpg images into a gif file
convert -delay 250 -dispose Background *.jpg images.gif
then convert that gif file into mp4 format
ffmpeg -f gif -i images.gif outfile.mp4
I would love to have a better answer than this.
I have the following image that I'd like to prepare for an OCR with tesseract:
The objective is to clean up the image and remove all of the noise.
I'm using the textcleaner script that uses ImageMagick with the following parameters:
./textcleaner -g -e normalize -f 30 -o 12 -s 2 original.jpg output.jpg
The output is still not so clean:
I tried all kinds of variations for the parameters but with no luck.
Does anyone have an idea?
If you convert to JPEG, you will always have the type of artifacts you are seeing.
This is a typical "feature" of JPEG compression. JPEGs are never good for images showing sharp lines, contrasts with uniform colors between different areas of the image, using only very few colors. This is true for black + white texts. JPEG is only "good" for typical photos, with lots of different colors and shading...
Your problem will most likely completely get resolved if you use PNG as an output format. The following image demonstrates this. I generated it with the same parameters as your last example command used, but with PNG as the output format:
textcleaner -g -e normalize -f 30 -o 12 -s 2 \
http://i.stack.imgur.com/ficx7.jpg \
out.png
Here is a similar zoom into the output:
You can very likely improve the output even more if you play with the parameters of the textcleaner script. But that is your job... :-)
How to convert whole image gallery or family album from JPG to BPG image format?
I'm looking for some batch conversion tool, application or script on Windows platform.
Input directory must be processed recursively and image quality should be preserved.
Linux command line fragment I use for this task, with current directory being gallery of '*.JPG' files, without subdirectories.
parallel -i sh -c 'convert -quality 100 {} -scale "1280x1000>" {}.png && bpgenc -q 30 {}.png -o {}.bpg && rm -f {}.png' -- *.JPG
You may adjust (or remove) resizing and change -q 30 to lower value for more quality.
It depends on ImageMagick and bpgenc.
To run in on Windows, you probably will need Cygwin.
Look at
http://www.romeolight.com/products/bpgconv/
for nice Windows converter.
2 things to mention: Currently there is options menu in top right of window. And all BPG pictures are saved into folder on your desktop called bpg_encoded.
Martin
I tried to flip horizontally the images in a specific folder using ImageMagik. But the mogrify -flop *jpg is changing all the images in their mirror images. I want to keep the initial images and for the flopped ones I want to rename them as *_flop.jpg. I am stuck: How to do it?
Assuming you are on Linux or OSX, like this:
#!/bin/bash
for f in *.jpg; do
new="${f%%.jpg}_flop.jpg"
echo convert "$f" -flop "$new"
done
At the moment, it does nothing, it just tells you what it would do. If you like what it shows, just remove the word echo and run it again.
Save the code above as flopper, and then go to Terminal and type this:
chmod +x flopper # Just do this one time to make the script executable (runnable)
./flopper # Actually run it
Update:
For newer versions of ImageMagick (version 7 onwards) you do not need to write:
convert -flop
Instead you need to write:
magick -flop
So your script essentially becomes:
#!/bin/bash/
for file in *.jpg
do
magick $file -flop ${file%%.jpg}_flop.jpg
done
Note: This works when your filenames don't have spaces or newlines in them.
I need to save a bunch (several thousand) of images with imagemagick.
I'm totally new to it, and its documentation seems totally opaque and totally labyrinth. Where's the quickstart guide?
Looking at it, I think I want to use mogrify.
so I cd to my program files directory where I installed imagemagick.
I run mogrify -format png *.png as I see in various examples.
It says:
mogrify: unable to open image `fgimg\': No such file or directory # blob.c/OpenB
lob/2489.
mogrify: unable to open file `fgimg\' # png.c/ReadPNGImage/2865.
How do I instruct it to run on all images in the subdirectory \fgimg?
Thanks a lot!
The problem here is that you're hitting the limit of how much you can put on a command line. You need to split it into chunks that will fit. This should work better:
find -name '*.png' -print0 | xargs -0 -r mogrify -format png
The -print0 and -0 are used to handle spaces in filenames, and the -r means don't run mogrify if there's nothing to do.