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.
Related
I noticed that PNG files created by Gimp from the same RPG data are identical except for the very beginning. This image shows a diff of otherwise identical PNG files created with Gimp:
What is this data which changes each time and how is it encoded? Are there tools to decode it? Can you learn something from this information, e.g. can you find out when a PNG file was (probably) created by this information?
I was under the impression that PNG files are created deterministically* and don't store meta data which isn't necessary to decode the image. (Obviously, the last part is not true, either, as Gimp writes its own name into the files but doesn't ask the user (which is does if you export something as a JPEG file).)
* I use the word "deterministic" here to refer to things and only such which are the same on each execution/export/whatever given the same input. I'd usually use the word "functional" (i.e. like a mathematical function) but I fear this could be misunderstood by people who don't know what "functional" means in mathematics. Obviously, this is different from the usage of this word in information theory.
See the PNG header definition.
tIME stores the time that the image was last changed, so for me it's the same as the timestamp of the file you create.
bKGD gives the default background color. Possibly the bakcgournd color you are using in Gimp, or the color of the transparent pixels.
tEXT with key Comment and value Created with Gimp is just the default comment. You can change the comment for the image in Image>Properties and you can set a default comment in Edit>Preferences>Default Image
When I export the same PNG twice, I only see a change in tIME. In fact I can't get a bKGD item, even when exporting a PNG with transparent pixels. Are you using any specific options when exporting?
Is there any way to bulk download background images from an image sequence?
Specifically, I'm looking to download the different image sequences from this website: lookbook.reebok.com
I found a solution to it. In terminal, write curl http://asdf.com/what/ever/image/img[00-99].gif -o img#1.gif And change it to your desired URL, number of images and format. If you write a number thats higher than what exists, terminal will create empty files in the format you requested.
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.
New to Matlab, so sorry if this is a silly question. I'm filtering a series images for my research. I'm not having a problem with the actual image processing, it's when I go to save the modified images that I run into trouble. For some reason, I can only save the modified images using imwrite as .gif files. If I try to save them as .jpg, .bmp, etc., the file does not appear in the working folder. The corresponding generic file appears, but the actual .jpg does not. Additionally, when I use imread to reopen the midified files (that actually saved as .gifs), the image is just black. But, if I open the .gif file outside Matlab, it appears as expected. Code below.
close all
N=90;
IMAGES=cell(1,N); %creates a cell to store image data
FNAMEFMT='20110805115033(1)_%d.jpg';
for i=1:N
IMAGES{i}=imread(sprintf(FNAMEFMT,i)); %reads original images into IMAGES
end
RESULT=cell(1,N); %to store modified/filtered images
for i=1:N
gray=rgb2gray(IMAGES{i}); %converts to grayscale
binary=im2bw(gray,.5); %converts to bw
filter=bwareaopen(binary,35); %removes small features
RESULT{i}=filter; %saves modified image in RESULTS
end
for i=1:N
WRITEFMT='filter_%d';
imwrite(RESULT{i},sprintf(WRITEFMT,i),'gif'); %writes RESULTS as .gif
end
If I try to save them as .jpg, .bmp, etc., the file does not appear in the working folder.
You need to change
WRITEFMT='filter_%d';
to
WRITEFMT='filter_%d.jpg';
The files you are outputting are jpeg files (as per the imwrite argument 'jpg' instead of 'gif'), but they don't have a file extension. If you manually add the extension, they open as jpgs.
For the black gif, see if this helps.
Once you export as jpg, viewing them works
imshow(imread('filter_1.jpg'))
I heard there is some way, to add additional hidden text inside code of the image file (like jpg/png/gif).
If we open this image in windows, will be shown a picture, but if we open it by some text-editor (like notepad++), we will see our hidden text.
How is this method called? What can you say about it?
Thanks.
Look up steganography. There are lots of tools to add any kind of hidden data you want in there. Usually though, it's not readable by notepad though. you need a companion tool to the one you used to add the data in in the first place. Using this you can even hide a binary file inside.
OR... you could look into using the metadata -- EXIF -- of the JPEG. Lots of tools exist to edit that data too. It ends up stored in the header of the file, so it should be right near the beginning, in other words the file would look something like:
JFIF ..... (GARBAGE) ..... Your Metadata ...... (GARBAGE)
Or finally, I hear that you can just concatenate a RAR onto the end of a JPEG and it will work as a (strangely huge) JPEG but WinRAR will notice the RAR contents when you open it in WinRAR.
This is called steganography.
I think its primary industrial use is watermarking content.
Information Hiding: Steganography & Digital Watermarking is a good resource on the topic.
Use "copy" - copy two files in one.
copy /B img.jpg + some.txt
Thus both file will be merged into the img.jpg file. The text from some.txt is append to the end of the img.jpg file.