Let your images lie in /pathtoimages/unchanged/.

Create the folder /pathtoimages/changed/

SetDirectory["/pathtoimages/unchanged/"];
names = FileBaseName /@ FileNames["*.png"];

I'm using the extension png in my example, as I have a bunch of png images somewhere on my machine. If you have photos, they're most likely with the extension jpg - adjust accordingly.

Do[im = Import[name <> ".png"]; 
 Export["../changed/" <> name <> "_blackwhite.png", Binarize[im]];
 Export["../changed/" <> name <> "_grayscale.png", ColorConvert[im, "Grayscale"]];
 , {name, names}]

It's quite slow - took about 30 seconds for 11 files with a total size of 3MB

Answer from LLlAMnYP on Stack Exchange
🌐
Wolfram Language
reference.wolfram.com › language › ref › format › PNG.html
PNG (.png) - Wolfram Language Documentation
Supports alpha channels for 8-bit and 16-bit RGB and grayscale images. Has support for color-reduction palettes using 2, 4, 16 or 256 8-bit RGB colors. Developed in 1995 as an open and patent-free alternative to the GIF format. Published as international standard ISO/IEC 15948:2003 and ISO/IEC 15948:2004. Import["file.png"] imports a PNG file, returning a single Image object or a list of images.
🌐
Wolfram Language
reference.wolfram.com › language › guide › GraphicsImportingAndExporting.html
Graphics Importing & Exporting—Wolfram Documentation
The Wolfram Language also has powerful capabilities for importing graphics, geometry, and other formats—immediately translating to a variety of fully integrated symbolic forms. Export — export static or animated graphics, or geometry data · Import — import from files and URLs as images, animations, graphics primitives, etc. "JPEG" ▪ "TIFF" ▪ "PNG" ▪ "GIF" ▪ "HEIF" ▪ "SCT" ▪ ...
🌐
Wolfram Documentation
reference.wolfram.com › language › howto › ImportAndExportImages.html
Import and Export Images - Wolfram Language Documentation
The import and export of images are the most common first and last steps of practically any image processing computation. Use the Insert ▶ File Path menu item or type a file path to import a local image file as an image object.
🌐
Wolfram Language
reference.wolfram.com › language › ref › format › PNG.html
PNG—Wolfram Documentation
Supports alpha channels for 8-bit and 16-bit RGB and grayscale images. Has support for color-reduction palettes using 2, 4, 16 or 256 8-bit RGB colors. Developed in 1995 as an open and patent-free alternative to the GIF format. Published as international standard ISO/IEC 15948:2003 and ISO/IEC 15948:2004. Import["file.png"] imports a PNG file, returning a single Image object or a list of images.
🌐
Wolfram Language
reference.wolfram.com › language › guide › CreatingAndImportingImages.html
Creating & Importing Images—Wolfram Documentation
Copy, Drag/Drop — copy and paste an image directly into a notebook · Import — programmatically import any standard format (TIFF, PNG, JPEG, DICOM, ...)
🌐
Wolfram Language
reference.wolfram.com › language › ref › format › JPEG.html
JPEG—Wolfram Documentation
Stores images as bitmaps at a resolution of 8 bits per color channel. Binary format. Uses a lossy compression method based on an 8×8 block-sized discrete cosine transform. Supports different compression levels. Import["file.jpg"] imports a JPEG file, returning an image.
Find elsewhere
🌐
Wolfram Documentation
reference.wolfram.com › language › howto › ExportGraphics.html
Export Graphics - Wolfram Language Documentation
Importing Graphics and Sounds · The Structure of Graphics · How to: Get an Image into the Wolfram System · How to: Import and Export Images · How to: Import and Export · How to: Process Images · Export · Importing & Exporting · Importing & Exporting in Notebooks ·
🌐
Stack Exchange
mathematica.stackexchange.com › questions › tagged › png-format
Newest 'png-format' Questions - Mathematica Stack Exchange
January 23, 2016 - I need that white background to be a completely ... ... For importing png images I use often: image = First@Image`ImportExportDump`ImageReadPNG[fileName] (see: ?*`*PNG*) since this is faster than: ...
🌐
Wolfram Language
reference.wolfram.com › language › ref › Image.html
Image: Raster graphics as 2D grid of pixels (JPEG, PNG, etc.)—Wolfram Documentation
November 20, 2018 - Upon output, an Image formats as a picture of the actual image, not as a 2D array of values. Image objects may be exported to a variety of standard image formats using Export, and images in a number of formats may be imported as Image objects using Import.
🌐
Wolfram Language
reference.wolfram.com › language › guide › RasterImageFormats.html
Raster Image Formats - Wolfram Language Documentation
The Wolfram Language can export anything it displays—graphics, text, formulas, notebooks—to any standard raster image format. It can also import from such formats to give Wolfram Language symbolic graphics, arrays of values, or metadata in various forms.
🌐
Wolfram Documentation
reference.wolfram.com › language › howto › GetAnImageIntoTheWolframSystem.html
Get an Image into the Wolfram System—Wolfram Documentation
There are many convenient ways to get an image into the Wolfram System , including drag and drop. You can also import images by evaluating commands in a notebook. Once you have an image to work with, you can use any number of the Wolfram Language ...
Top answer
1 of 3
8

Make your filenames unambiguously parsable, e.g. by consistently using some delimeters like underscores or something. A typical file name can look like "Electric_B_3.png". EDIT If you have no control over the file names, use string patterns as described by other answers, but in the long-term you may benefit from creating your own robust naming scheme END EDIT

Then write a function that would parse a single file name, something like:

fileNameParse[fname_String, delim_String: "_"] :=
   StringSplit[FileBaseName[fname], delim]

Then, Map it on FileNames["*.png", {your-dir}].

Finally, apply your importOne on the level one:

importOne@@@Map[fileNameParse, FileNames["*.png", {your-dir}]]

Since you have the result of Map available as well, you can regroup them any way you want. You can, for example, Map a function {#, importOne@@#}&, rather than just using importOne@@@.... Then, you could use GatherBy or any other means to regroup and collect your images according to the parts of their filenames.

EDIT

Here is a self-contained example ( I use text files, but this doesn't matter):

ClearAll[fileNameParse, fileNameMake, importOne, $dir];
fileNameParse[fname_String, delim_String: "_"] :=
    StringSplit[FileBaseName[fname], delim];

fileNameMake[pieces_List, delim_String: "_", ext_String: ".txt"] :=
    StringJoin[Append[Riffle[pieces, "_"], ".txt"]];

importOne[set_, cat_, num_, dir_: $dir] :=
    Import[FileNameJoin[{dir, fileNameMake[{set, cat, num}]}]];

We now create a temporary directory:

$dir = FileNameJoin[{$TemporaryDirectory, "ImportTest"}];
If[! FileExistsQ[$dir], CreateDirectory[$dir]];

Create sample files:

MapIndexed[
   Export[#, "Test" <> ToString[#2], "Text"] &,
   Flatten[
     Outer[
       FileNameJoin[{$dir, fileNameMake[{##}]}] &,
       {"Electric"}, {"A", "B", "C"}, {"1", "2", "3"}
     ]]];

import them:

imported = Map[{#, importOne @@ #} &,  fileNameParse /@ FileNames["*.txt", {$dir}]]

(* 
  ==>

     {{{"Electric", "A", "1"},  "Test{1}"}, {{"Electric", "A", "2"}, "Test{2}"}, 
      {{"Electric", "A", "3"},  "Test{3}"}, {{"Electric", "B", "1"}, "Test{4}"}, 
      {{"Electric", "B", "2"},  "Test{5}"}, {{"Electric", "B", "3"},  "Test{6}"}, 
      {{"Electric", "C", "1"},  "Test{7}"}, {{"Electric", "C", "2"},  "Test{8}"}, 
      {{"Electric", "C", "3"}, "Test{9}"}
      }
*)

You can now, for example, group them according to whatever parts of their file names you wish:

GatherBy[imported , #[[1, 2]] &][[1]]

(* 
 ==>

{{{"Electric", "A", "1"}, "Test{1}"}, {{"Electric", "A", "2"}, "Test{2}"}, 
   {{"Electric", "A", "3"}, "Test{3}"}}

*)
2 of 3
7

Here is one approach. First set your working directory with SetDirectory, then:

names = FileNames["*.png"];

groups = GatherBy[names, StringTake[#, {-6}] &];

Evaluate[
   electric[StringTake[#, {-6}]] & /@ groups[[All, 1]]
] = Map[Import[#] ~ImageResize~ 128 &, groups, {2}];

Now access image lists like:

electric["B"]

This relies on manually picking a string position to index by, here {-6}. Leonid's method would be more robust for future naming.

🌐
Wolfram Community
community.wolfram.com › groups › - › m › t › 1424317
Import a lot of images with Mathematica? - Online Technical Discussion Groups—Wolfram Community
Wolfram Community forum discussion about Import a lot of images with Mathematica?. Stay on top of important topics and build connections by joining Wolfram Community groups relevant to your interests.
🌐
Wolfram Language
reference.wolfram.com › language › ref › ImageResolution.html
ImageResolution - Wolfram Language Documentation
ImageResolution is relevant only for bitmap graphics formats such as "PNG", and not for resolution‐independent formats such as "SVG".
Top answer
1 of 1
2

Here a two ways to save all your notebook graphics to PNG files :

1. Web page with PNG Graphics

This is the quick and indirect way to do that and is actually what you tried. But as you said, by default the exported graphics in the folders are in the GIF format. To Export a notebook to a web page with all the graphics in PNG, this seems to work:

Export["test.html", EvaluationNotebook[], "GraphicsOutput" -> "PNG"]

You have to type the command directly in the notebook containing the pictures (for example at the end of it).

Or if you prefer to run the command from another notebook:

nb = NotebookOpen["your_notebook_file_path"];
Export["test.html", nb, "GraphicsOutput" -> "PNG"]
NotebookClose[nb];

2. Programmatically Export only the graphics

Though I am not really familiar with low level notebook programming, here is some more direct approach I've succeeded to get. It allows to search for all the (2D) graphics in a given notebook and export them to whatever format.

First, as previously, choose the notebook you want:

nb = NotebookOpen["your_notebook_file_path", Visible -> True];

or we can here instead use this demo notebook (from the documentation):

nb = CreateWindow[
   DocumentNotebook[{CellGroup[{TextCell["Text Group", "Section"], 
       TextCell["Mary had a little lamb.", "Text"], 
       TextCell["Its fleece was white as snow.", "Text"]}], 
     CellGroup[{TextCell["Graphics Group", "Section"], 
       ExpressionCell[ Plot[Exp[-x^2], {x, -3, 3}], "Output"], 
       ExpressionCell[ Plot[-x^2, {x, -3, 3}], "Output"]}]}]];

and then run:

SelectionMove[nb, Before, Notebook]; SelectionMove[nb, Next, Cell];
i = 0;
While[(nr = NotebookRead[nb]) =!= {}, 
 If[MatchQ[nr, Cell[BoxData[GraphicsBox[__]], __]],
  i++; Export["test_" <> ToString[i] <> ".png", nr]; Print[i]]; 
 SelectionMove[nb, Next, Cell]]
NotebookClose[nb];

which will print the number of exported graphics as it runs. In your case (1000 graphics) that might be useful to monitor the process. It is easy to adapt the code anyway, in particular to modify the file names (here "test_") and the format of exported graphics (here ".png"). That's it.

Remark: For those which are more familiar with low level notebook programming, i've not been able to use the command SelectionMove[notebook, Next, Graphics] to select iteratively the graphics ... If someone could explain how it exactly works ?