Page 1 of 1

General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-24T04:15:20-07:00
by philips
Hello imagemagickians

I know I about to ask a lot of question but I have all my hope vested in you. Thank you already!!!!!!! I hope you can help me somehow. But I am confident seeing my relative noobism on linux and imagemagick scripting.

My problem is two parted.

1) I need to resize a large amount (2 million in 60000 parts folders) jpgs. They are not terribly big (each 4 kb) and I actually want to make them smaller (x31). It used to be thumbnails now it ll go up on a wall and be approx 3.1mm high in case you wonder.
I wonder what the fastest way to do this would be?

(SubQ a:) I use the resize mogrify -resize x31 *.jpg. What the best way to enter all the subfolders here? And with best I mean fastest as I am pressed for computation time.

(SubQ b:) I am working from a mac osx virtual box ubuntu setup. And I have a folder that I share between both environments. Is that costing me a lot in computation time? Should I import the folder? This would be a problem as it takes a lot of time as well seeing the amount of files.

(SubQc:) In the end (once all resized and in a proper location depending on your tips) i want to montage the images on one canvas. The wall on which I ll print is 4x5 m large. So I ll most likey montage in chunks of 60 cm heigt and with a certain width (4m). Is there a way to fix that? I only found subcommands for mount of images. I use:

montage *.jpg -tile 350 (love to enter cmwidth)-geometry +0+0 -background white -gravity Center print.jpg

(SubQd:) Now would it be possible to load multiple folder into one montage without it taking too long? Basically I have multiple languages and I would want to start with engl (folder eng 60000 images), then move to dutch(folder 2), ... ? Is that possible or would I have to copy the right amount of images in one folder in order to fill it properly?

(SubQe LASTTTTT) the montage works from left to right and from up to down. Can I change that? I d want from down to up and even one versio n fom right to left montaging.

Dear Imagemagick I know I ask alot but I also appreciate your help alot. A lot. Individuals will be thanked in a museum in case someone likes that. Individuals are thanked already for th etime you have taken.

THANK YOUUUU
philip

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-24T05:55:14-07:00
by pipitas
philips wrote:Hello imagemagickians
I know I about to ask a lot of question [...]
[...]Individuals are thanked already for the time you have taken.
THANK YOUUUU
philip
Honestly I do not yet fully understand the exact requirements you have (other than you want tips to get it done efficiently).

But before efficiency comes understanding the intention.

So what I got:
  • You have 2 million pictures, each one about 4 kB.
  • The pictures are distributed in 60000 subdirectories.
  • You want to scale these pictures down to a height of 31 pixels each.
  • You want to montage scaled-down pictures in a tiling fashion.
  • The tiling should result in an big image.
  • The big image should be printed to fill a 4 x 5 meters wall.
  • You want the montage order to follow certain rules depending on the names of the subdirectories.
What I'd like to understand:
  • Are all original pictures of the same size (not filesize, but dimension)?
  • If they don't have the same dimensions, do they have the same aspect ratio (proportions)?
  • If they don't have the same aspect ratio, should the scaling result in fixed-width of 31 pixels, preserving the original proportion?
  • Are the pictures all in the same file format (like JPEG)?
  • Are they all in the same color space (like RGB)?
  • Do the 60000 subdirectory names follow any naming pattern?
  • Do the picture names follow any naming pattern?
A quick'n'dirty rule-of-thumb calculation tells me that each thumbnail within the big-wall 4x5 meters picture will have a width and heigh of about 3-4 mm. Is that correct?

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-24T10:01:30-07:00
by fmw42
Use -thumbnail rather than -resize to cut the file size. The former gets rid of most meta data. If speed is an issue rather than quality, then use -scale (add -strip first if you want to remove the meta data)

mogrify will not traverse all subdirectories. It works on one directory at a time. But you can write a script to loop over every subdirectory you want and use convert rather than mogrify. Also see http://www.imagemagick.org/Usage/basics/#mogrify_not


To montage in other directions, you would have to flip, flop or rotate or transpose the images, then montage, then reverse the flip, flop or rotate or transpose on the result.

see
http://www.fmwconcepts.com/imagemagick/ ... ntage_cols

Untested, but you may be able to do

montage path2folder1/*jpg path2folder2/*.jpg etc ....

The problem may be how much memory is taken by all the images.

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-24T11:09:51-07:00
by magick
To reduce memory requirements, specify the image size @ the beginning of the command line, e.g., -define jpeg:size=256x256.

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-24T16:59:54-07:00
by philips
Thank you already very much everybody.

Great suggestions!!

Its kind of late but I ll look into the thumbnail option tomorrow. The images already were thumbnails already but 31px is exaclty the height I need. Seeing I shrink it even further by an post hoc dpi increase to 240 for the printer. And you were right pipitas they will be 3.1mm tall each. The entire wall will hold about 3 million images. All images (no doubles) of the two concepts of the exhibition.

Transposing the images is also a good idea. Though a little intricate. and also maybe time extensive. The printer deadline is fast approaching. :)

To adress some of the questions and or to clarify:

I have 2-3 million images in folders (arranged by languages and words) with each approx 60000 images inside of them. so NOT 60000 subdirectories.

Scaling them down to 31px. I print on 240 dpi leading to the images to be exaclty 3.1 mm in the end.

I want to montage in a tiling fashion. Probably multiple tiles as the height of the printer is e.g. 60cm x 4 m. But thats not your problem really. I ll take care of that somehow.
and indeed i want to montage it in a given order so say:
"montage on a canvas of 60x 4mm and fill it with the tiles of the folders x,y,z and in this order (maybe with a null filler in between))! "

Now to the understanding
no the images differ. The are random thumbnails and some are small, some are wide, some are high. Thats why i want to resize in order to keep th eproportions fixed. (this also leads to a problem with montage as I can only indicaete the amount of images I want to use instaed the width to be filled/ and the images differ in widths).

so also no same aspect ratio. and it should remain in the same proprtions as does resize.

The colorspace I ll deal with later. It ll be composed in apple rgb and probably assigned a new profile later.

the subdirectories have a pattern but they are not that many so I d rather do that by hand. The organizing principle behind it is 2 concepts (empathy greed)/ 2 or more languages/ and then some synonyms and the search terms themselves as subfolders with about 60000 results.

Also just a new problem arose.
I get the error that the argument is too long probably because the image ames are the links aka they are very long possible containgin prohibited signs. Is there an easy batch for assigning image1-x as a name for each file and folder in a subdirectory?


I ll go to sleep and thank you very much
Very much
philip

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-26T14:39:52-07:00
by philips
No more help?

Did I say something wrong?
p

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-26T14:57:50-07:00
by fmw42
Not much more to suggest until we hear back how things are progressing or what the issue might be.

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-27T03:48:15-07:00
by philips
ok.

well I thought seeing I updated the questions from pipitas there might be coming still.

I still have the same problems.

General is described below.

1) Now I run into the length problem. How can I set a cm width instead of a column width (which doesnt work seeing my images have different widths)?
2) I can cluster up to 10 000 thumbnails which is great. BUT everything above it leads to 'segmentation fault (core dumped)'.
3) Then all the cluster option dont seem to work (same is true for -define size:jpg...). I ve tried different options but nothing seems to change. Sometimes I get an error (when I exceed 800 columns) that tells me that imagemagick only supports 65000 pixels composites.
5) Most importantly I am thinking that the best option would be a -append with a fixed cm width and if possible a max of x rows as to fit 10000. These images I could then manually build on top of each other. But somehow I cm length is a problem.
4) montaging from bottom to top I ll do manually. And to the transpose option I didnt get to yet.
5) Then I still have the problem that I dont understand how to automatize (batch) the loading of images into a montage into a folder.

So thats it. Same problems as before.

and thank you again
p

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-27T10:22:56-07:00
by fmw42
IM will not, to my knowledge, work in cm, only pixels. You will like have to convert the cm using the density to pixels.

I cannot answer you segmentation fault

What cluster options? What command?

I do not understand enough about your batch issue. What exactly do you need to do? Scripting is different for unix and windows.

Re: General Problem: Gigantic Quantities (with sub problems)

Posted: 2012-08-28T09:55:24-07:00
by philips
the pixel calculation would be ok but somehow I dont manage. Look the width is:

4 m which is 157.48 inches with 72 dpi leading to 11338.56 pixels. BUT, because I ll have to print on 240 dpiI have to increase with a factor 3.33333 (240/72 dpi) . This leaves e witha total of 37795.2 pixels per row. Somehow with montage I can get it squared nicely but the pixel limitations dont seem to work at all.

I use e.g: montage jpeg:siz=500x500 geometry +0+0 *.jpg 16.jpg

this width I d like to fill with images from different folder (Batch question. But I can do that manually I m afraid/ I work with linux ubuntu)

Once from left to right, once from right to left (ITs two images in essence). Bothshould go from bottom to top in the montage.
How would the append option work here? With convert? And could I set a pixel width and direction?

I m really glad for any type of hints because I m dealing with so many images.
thank you again everybody
p