I need to resize a lot of jpeg images from the original to 220x160 for a website.
I'm currently just opening in paint and resizing them manually, then adding -w to the end of the filename.
Note that we are not resizing them using html on the website itself because it's slowing down the website.
Is there a way to resize e.g. 10+ images to 220x160 and append -w to all the filenames without doing it manually, and without using software that I must buy?
Thanks
You can do that with ImageMagick which is free and available for Windows and Linux and OSX here.
To do a single image, you would type the following into the Command Prompt in Windows:
convert input.jpg -resize 220x160! input_w.jpg
I can probably work out how to do it in a loop, if you wait a while, or someone else may tell me the FOR syntax for Windows...
Ok, Windows isn't my thing, but something like this to make all the smaller images and save them into a subdirectory called SMALL
MKDIR SMALL
FOR %x in (*.jpg) DO convert %x -resize 220x160! SMALL\%~nx_w.jpg
Irfanview is free and has command line processing which you can use in a batch file.
Related
Another person asked this question but the answers are not adjusted to the average civilian comprehension.
I am trying to convert an entire folder to grayscale, using image magick.
I want to convert the entire folder of JPG and PNG images that are in color to grayscale.
Things that I know: I know to open notepad, copy-paste text aka code, save it as a bat, save it in a specific folder, and click run.
Anything beyond what is listed is not within my skills.
I see here on this website a million questions that I also have but answers are not end-user friendly. For example, no one mentioned that we can't have folder names with spaces in the Run command line window.
Codes are not full but in fragments throughout messages and there is no conclusion at the end when the problem is solved that gives step-by-step procedure on how to solve the problem.
Can anyone help with the full code I need to have in notepad for the batch procedure to work?
Thank you.
No need for Notepad. Start a Command Prompt and change directory to the one containing your images. So if your images are in HOME/Images, type:
cd Images
then press Enter/Return. Then type:
magick mogrify -colorspace gray *.png *.jpg
then press Enter/Return and you're finished.
I am editing an image in Gimp with dimensions and size specified as below.
How to use the same parameters in ImageMagick? (I tried something like below, but unable to get the desired output):
convert clipboard:image -crop 741x610+274+57 image.png
And how to copy this image back to clipboard?
I don't currently have a Windows system around (the clipboard: thingie works only on Windows -- for Mac and Linux there are no equivalents within ImageMagick).
But I think it should work like this:
convert clipboard: -crop 741x610+274+57 +repage clipboard:
However, I'm wondering why you use the clipboard for output at all? Why do you require to write back to the clipboard? (There may be other means to achieve what you want...)
I have several postscript images of the form "filename_0001.ps", "filename_0002.ps", etc. I would like to create an animated gif with each of the files as a frame in the animation, but I do not know how I would go about doing that. I have over 500 files that I would like to include in a single gif and would like to avoid creating the animated gif by hand.
I googled around for a bit and found this. At the very bottom it seems to suggest that there is a one line command that can be used to make the gif, but I haven't been able to figure out how to use it in my case.
Any suggestions would be appreciated.
I've used ghostscript and ImageMagick's convert to do this. I used these commands
gs -sDEVICE=png48 -g500x500 -o bezan%03d.png bezanim.ps
convert bezan*.png bezan.gif
to produce this animation for this Codegolf.Stackexchange challenge, where the frames were separate pages of a single postscript program.
You can probably do it with the single command
convert filename_*.ps anim.gif
and convert will shell-out to ghostscript as needed. But for my case, I wanted to specify the arguments to ghostscript directly.
I'm using Ghostscript to turn PDFs into jpeg thumbnails. It works great for most files, but I've got a few that end up looking bad - like a tiny thumbnail on a huge white background.
This is because, on those problem PDFs, the MediaBox is set to a much larger size than the CropBox. I can fix this in Ghostscript by using -dUseCropbox to make it ignore the MediaBox dimensions ... but that does not work on other PDFs that have no CropBox defined.
So I can think of two solutions:
Somehow check a PDF file before import to see whether it has a CropBox defined. If it has a CropBox, then use the -dUseCropBox switch. If it does not have a CropBox defined, then we do not use that switch.
Modifying the MediaBox dimensions in the PDF file itself so that they match the CropBox dimensions.
So what code would I use to check a PDF file for CropBox/MediaBox dimensions and, if necessary, edit them?
What do you plan to do with files that have no CropBox ? It seems to me that you are already doing everything you can, if a CropBox is present (and you select -dUseCropBox) it is used, if not then (if I recall correctly) GS will use the MediaBox anyway.
I think what you're really looking for is a program / script to crop whitespace from PDFs, irrespective of the media/trim/crop box setting, you could try either of these freeware pdf croppers:
pdfcrop - a perl script, works on multiple platforms
http://tug.ctan.org/tex-archive/support/pdfcrop
(requires *tex, ghostscript and obviously perl)
PDF Cropper, for Windows
http://www.noliturbare.com/pdf-tools/pdf-cropper
(requires ghostscript and .NET 3.5)
Alternatively, if you have a Mac, you could use the crop function on the Preview application. This sets the cropbox without touching the mediabox (at least it does on MacOSX 10.4), allowing you to use -dUseCropbox.
Instead of Ghostscript, use Imagemagick. For example:
convert -resize 70px file.pdf file.jpg
I'm working on a Sidebar Gadget and cannot get my JPEGs to show up (PNGs work). When I try to open the file by itself in IE8 it doesn't work. Firefox, of course, can open it fine.
JPEG Details:
Dimensions: 1080X900
180 dpi
Bit depth 24
Color representation: uncalibrated
I've found some things talking about the images being compressed incorrectly (?) but I haven't been able to get it working...
Any clues?
IE8 drops support for CMYK JPEG and renders them as the infamous red X without so much as a warning.
If you have ImageMagick:
identify -verbose image.jpg
will show you the image colorspace. If it's CMYK, you can convert to RGB with:
convert broken.jpg -colorspace RGB fixed.jpg
If you need to do CMYK to RGB conversion on a whole batch of JPEG-images, this command may be helpful to you:
for i in *.jpg; do convert "$i" -colorspace RGB "$i"; done
PS: If you'd like to see what is going on, just add -verbose:
for i in *.jpg; do convert "$i" -colorspace RGB -verbose "$i"; done
I had a similar issue with IE8 not displaying two JPEG images. FF, Safari, Chrome all displayed them without complaint but IE acted as if the files were not there. I have no idea what was going on, but a quick image conversion to gif or png fixed the problem. Just another in a long line of confirmations that IE sucks.
Had similar problems with existing images, which will not show up in IE8.
Problem is, as converter42 says: CMYK-Images
Convert them to RGB colorspace and all is good
The Solution with the PNG is not the best, because PNG files can be MUUUCH larger than JPGS.
If you are using photoshop for creating the jpgs. Try the below.
Open the file and go to 'Image' menu
Go to Mode
Select RGB
Save and upload to server.
This should work.
Why are you dealing with the image at 180 dpi and not the 72dpi screen resolution? At screen resolution the image will be roughly double that size. Still, the size is manageable for any browser.
When creating a gadget, you should be using PNGs for all the elements of the gadgets. Are you having issues displaying JPEG photos?
Have you looked for the yellow bar at the top of IE that blocks certain suspicious content from being loaded (popups, activex, javascript, etc.)? If it appears, try telling it to "allow".
Lastly, what are you using to compress your images to JPEG?
EDIT: If you want to do batch conversion use the batch converter in photoshop or use the Actions panel to record the conversion process for a single image, then replay the action on an entire folder. Additionally, you can save this action to a "droplet" which is a small application containing the action that you can drop an image or folder on top to.
Alternatively, if you don't fell like learning Actions, XNView is an excellent image viewer and converter that supports something like 160 different image formats and can batch convert and batch rename huge lists of files.
I fixed this issue by opening the CMYK JPEG file in Windows Paint and then saving as a JPEG, which Paint encodes as RGB by default. Not a great solution because I'm sure that Paint's converter is not as robust as Photoshop's, but this can be a quick fix if the job needs to be done now and there's no access to the tools above.