anyone know a free, stable commandline tool (besides ImageMagick) to convert .tif files and .pdf files to either .jpg or .png?
thanks Michelle
I prefer Imagemagick for Windows stuff, but IrfanView performs well, too. It looks like it has switches for command-line conversion of image formats, as well. See the "/convert" option.
tiff2png
On mac os x:
$ brew install tiff2png
$ tiff2png -compression 9 *.tif
Related
I'll try to make this as short as possible.
I have a folder that contains 9000 images (almost). But the extension of these images is png. I would like to change the extension of all these images in one command so they all become .jpg
If someone knows a way to do that can you please share it?
Thank you for your help.
If they are PNG images that you are trying to turn into jpgs, I'd recommend installing Imagemagick (via homebrew), and using the "mogrify" command to change them (see https://www.imagemagick.org/script/mogrify.php):
magick mogrify -format jpg *.png
If they are all actually jpegs, and you've ended up with the wrong file extension, you can do something like:
ls | grep \.png$ | sed 'p;s/\.png/\.jpg/' | xargs -n2 mv
See: Batch renaming files in command line and Xargs (even though it's linux, these tools are all available in the OSX default install)
I did it by using a virtual machine (Windows)
In the cmd I used this command : ren *.* *.jpg and it worked. Although I guess on Mac it's a bit harder.
When trying to add annotations to images in ImageMagick, It failed with the following message:
convert: unable to read font `(null)' # error/annotate.c/RenderFreetype...
How do I make Imagemagick find these fonts?
The solution that worked for me was given by Neville in this post:
Create an imagemagick configuration folder: mkdir ~/.magick
Save this Perl script as /tmp/script.pl
Make the script executable: chmod +x /tmp/script.pl
Run the script locally and redirect the output to the file type.xml in ~/.magick: /tmp/script.pl > ~/.magick/type.xml
This solved the fonts problem, while installing fondu, the imagemagick pkg file and some other tricks didn't.
Great! Now I can annotate some flickr cats with the image size and resolution (I want this for finding the optimal resolution for an app I'm working on).
Adopting Adam Matan's answer, here's how I got this to work with imagemagick 7+ on macOS 10.12+ installed with homebrew. (This also assumes you have perl installed.)
Download the perl script and save it to /usr/local/bin/imagick_type_gen
Make the script executable:
chmod +x /usr/local/bin/imagick_type_gen
Find the font path for imagemagick by running convert -list font | grep Path. This should return where imagemagick is looking for fonts. The Apple path for me was this:
/usr/local/Cellar/imagemagick/7.0.7-22/etc/ImageMagick-7/type-apple.xml
Run imagick_type_gen and direct the output to the path above:
imagick_type_gen > /usr/local/Cellar/imagemagick/7.0.7-22/etc/ImageMagick-7/type-apple.xml
Run convert -list font | less to see the font names imagemagick will use, e.g., some fonts will be labeled as GeorgiaB instead of Georgia Bold. (hit q to quit)
imagemagick should now see the fonts you have installed on the your system.
The easiest way to solve this issue is copying the font you need to a ~/ folder, or anywhere your script is, then give the direct path:
convert -font "~/MyFont.ttc"
I have an issue with the 2 images below: the first one is created on Linux, the second one on Windows using the same command, same versions of ImageMagick (6.6.5-0). Tried newer versions of ImageMagick and they all seem to provide different results Windows vs. Linux.
convert c.jpg -sepia-tone 80% 1.jpg (on Linux)
convert c.jpg -sepia-tone 80% 2.jpg (on Windows)
The results are very different and I cannot figure out why.
What am I doing wrong?
(source: selfip.com)
(source: selfip.com)
I actually had to do
convert c.jpg -set colorspace RGB -sepia-tone 80% 1.jpg
basically forcing the use of the RGB colorspace and that solved my problem.
Most likely, the release versions of your ImageMagick installations on Linux and Windows are different in more ways than the mere version numbers...
To verify, run this command and compare the outputs in detail for the two platforms:
convert -version
Additionally, you may want to see how the outputs for convert -list configure differ. (Note, the format of the outputs this command gives is different anyway on the two platforms -- they are not directly comparable).
I'm attempting to batch process some images using pngquant and I have realized I don't really know what I'm doing. I'm on a mac and I can navigate to the executable and open it, but after that I can't access any of the functions/features of pngquant.
Basically, I've gotten to the point of ./pngquant, but don't know what to do after that. Any help from anyone?
I've got a couple hundred images to run through, so it would be nice to not have save each of them individually...
If it were me, I would use Tiny Png It does essentially the same thing. (I am very unfamiliar with using the terminal as well.)
What exactly are you trying to process?
Here is an example on usage:
./pngquant 256 ../test/*.png
I am running the command from the pngquant directory and pointing it to my test directory where I have all my png files....
I would recommend pngquant to osx with the help of Homebrew (which you need to install first)
brew install pngquant
cd path/to/your/images
pngquant 256 *.png (all png-images)
You can use Batch tool
like a link!Acc image batch process[a panda][1]
this can dealwith png,gif,jpg and some other
I am doing some data mapping from an .xls excel document, and I am trying to write a quick script to pull images out excel document.
What is the quickest, simplest way to do this programatically?
I am running Ubuntu 10.10 and I would prefer to user python if possible.
a XLSX file is a compressed file.
$ unzip file.xlsx
in xl/media/ are all pictures. This is not true for older .XLS files, but you can convert them to XLSX with a modern version of MS Office.
If you don't have MS Office, you can do the same thing with LibreOffice. Convert the file to .ods and then open it as a zip file and it will be in the Pictures folder.
I hate to answer my own question, but the best method I found only required two commands at the command line (assuming you have the right software installed).
First, use unoconv to convert the .xls to .pdf:
http://dag.wieers.com/home-made/unoconv/
On Ubuntu 10.10 command line:
sudo apt-get install unoconv
unoconv -f pdf file.xls
Then extract the images from the pdf using pdfimages (which seems to come bundled with Ubuntu):
http://en.wikipedia.org/wiki/Pdfimages
Back on the command line:
pdfimages file.pdf fileimage
And done! All of the images in the .xls are now in separate files in the directory. This could be done very easily on most Linux systems using your language of choice. In python, for example:
import subprocess
subprocess.call(['unoconv','-f','pdf','file.xls'])
subprocess.call(['pdfimages','file.pdf','fileimage'])
I would love to hear a simpler solution if somebody has one.