Convert for Google Drive (2048x2048)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
john3voltas
Posts: 2
Joined: 2015-05-05T14:36:09-07:00
Authentication code: 6789

Convert for Google Drive (2048x2048)

Post by john3voltas »

Hello.
I have a small headless server with an ARM CPU that runs Archlinux ARM and I am a newcomer to Linux OS.
The reason why I'm using Linux it's because my server has veeeeery limited resources (cpu/ram). ;)
I have thousands of photos stored on that server in jpeg format that I would like to upload to Google Drive. I chose Google Drive because it's free cloud space where I can share some photos with my relatives and friends only.
And it has a nice bonus: it turns into unlimited free cloud space if my photos are uploaded in 2048x2048.
Up to this point it seems that it should be something relatively straightforward to do, even though I still haven't tried it, but I found a website that shows how to resize photos using ImageMagick.
I should say that In fact I want to keep the photos in their original format/size and additionally I want to create a folder with a resized version of those photos. Then I would upload the resized photos folder to google drive.
So, apparently all it should be something along these lines:

Code: Select all

mogrify -format jpg -verbose -auto-orient -resize 2048x2048 -quality 100% -path 'output' *.JPG
So, the obvious question is, will the above line resize all jpeg photos in the current folder to a folder named 'output' while keeping the original photos untouched?
Also, is it possible to automatically label the photos with their file names and folder path? For instance I would like a label to look like:

Code: Select all

/home/photos/wedding/change_rings.jpg
All that in a very small font size of course.

And while I am at it, does ImageMagick rotate a picture without loosing quality? I'm asking because I didn't find ImageMagick in the lossless jpegtran list of this website.

PS: Did I do anything wrong? While I was writing this post my account disappeared and I had to re-register :?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert for Google Drive (2048x2048)

Post by fmw42 »

Your mogrify command looks fine to me. But note that your output directory must be already exist and be referenced relative to the current directory holding your images (or absolute path) and you must cd to your input directory before issuing the command.

I suggest you create a two new directories, put a few images in it and then test your command, before running your real command.

With regard to labelling the photos with your directory, I do not think you can do that. For that I believe you would need to write a script loop and loop over each image in the input directory with a convert command and add the directory to the input name as part of the output name in addition to writing to your specified output directory.

In the future, please identify your IM version and platform as syntax may change.
john3voltas
Posts: 2
Joined: 2015-05-05T14:36:09-07:00
Authentication code: 6789

Re: Convert for Google Drive (2048x2048)

Post by john3voltas »

fmw42 wrote:Your mogrify command looks fine to me. But note that your output directory must be already exist and be referenced relative to the current directory holding your images (or absolute path) and you must cd to your input directory before issuing the command.
I suggest you create a two new directories, put a few images in it and then test your command, before running your real command.
Duly noted. I will run some tests with some photos that can be destroyed :)
fmw42 wrote:With regard to labelling the photos with your directory, I do not think you can do that. For that I believe you would need to write a script loop and loop over each image in the input directory with a convert command and add the directory to the input name as part of the output name in addition to writing to your specified output directory.
Do you mean a bash script? Or some other kind of script?
And how about forgetting about the path and labelling the photos automatically with their filename only? Would that be possible/easier?
fmw42 wrote:In the future, please identify your IM version and platform as syntax may change.
Well, I don't exactly know what you mean by platform. If it's the OS and the CPU, I did reference both on my message. I said I'm using Archlinux ARM on an ARM cpu. :)
Imagemagick version installed is 6.9.1.0.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert for Google Drive (2048x2048)

Post by fmw42 »

Do you mean a bash script? Or some other kind of script?
And how about forgetting about the path and labelling the photos automatically with their filename only? Would that be possible/easier?
Yes, bash script or just few command lines that can be copied and pasted into the terminal window.

With mogrify, the output files will have the same names as the input (automatically). That is why using -path to put the results in another folder/directory is the safest way to proceed.

Sorry I read your message and saw the linux, but forgot about it when I wrote my message.
Post Reply