RSS/Atom feed Twitter
Site is read-only, email is disabled

Scripting - How to save JPEG with thumbnails

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

Scripting - How to save JPEG with thumbnails Guillaume Bonillo 07 May 11:37
  Scripting - How to save JPEG with thumbnails Paul Surgeon 07 May 13:37
   Scripting - How to save JPEG with thumbnails Guillaume Bonillo 07 May 15:38
    Scripting - How to save JPEG with thumbnails Guillaume Bonillo 07 May 18:54
  Scripting - How to save JPEG with thumbnails Sven Neumann 07 May 22:14
Guillaume Bonillo
2007-05-07 11:37:56 UTC (over 17 years ago)

Scripting - How to save JPEG with thumbnails

Hi,

I am new to scheme scripting. What i want to do is open pictures from a directory and apply a very simple macro.

I can do it manually with the following steps : - open image "the_image.jpg".
- save as .... the_image_with_thumbnail.jpg - choose options : q = 0.85 , progressive, and default other options. - check the option : save thumbnail. - Click OK.
- close image.

Could someone show me some sample scripts to do that ? I've found several way to save a "thumbnail" in jpg or png format in a separate file,
but did not find any script matching the steps i've exposed ...

Thanks for any reply

G.B.

Paul Surgeon
2007-05-07 13:37:06 UTC (over 17 years ago)

Scripting - How to save JPEG with thumbnails

On Monday 07 May 2007 11:37, Guillaume Bonillo wrote:

Hi,

I am new to scheme scripting. What i want to do is open pictures from a directory and apply a very simple macro.

I can do it manually with the following steps : - open image "the_image.jpg".
- save as .... the_image_with_thumbnail.jpg - choose options : q = 0.85 , progressive, and default other options. - check the option : save thumbnail. - Click OK.
- close image.

Using a bash script or DOS batch file with imagemagick is a better and easier solution.

Below is a bash script that I use to create thumbnails of photos from my digital camera.
You can pass the jpg quality parameter to convert - I used the default which is 75% I think. The options are in the docs.

-----------------------------

#!/bin/bash

echo "Converting ..."

if [ ! -d "resized-1024x768" ] then
mkdir resized-1024x768
fi

if [ ! -d "resized-256x192" ] then
mkdir resized-256x192
fi

# Loop through all jpg files in current folder # ============================================ for i in *.jpg
do
FileName_Stripped=`echo $i | cut -d. -f1`

if [ ! -e "resized-1024x768/$FileName_Stripped-1024x768.jpg" ] then
echo "Converting $i to $FileName_Stripped-1024x768.jpg" convert -resize 1024x768
$i "resized-1024x768/$FileName_Stripped-1024x768.jpg" fi

if [ ! -e "resized-256x192/$FileName_Stripped-256x192.jpg" ] then
echo "Converting $i to $FileName_Stripped-256x192.jpg" convert -resize 256x192
$i "resized-256x192/$FileName_Stripped-256x192.jpg" fi
done

echo "Done"

-----------------------------

Regards Paul

Guillaume Bonillo
2007-05-07 15:38:56 UTC (over 17 years ago)

Scripting - How to save JPEG with thumbnails

Paul Surgeon a écrit :

On Monday 07 May 2007 11:37, Guillaume Bonillo wrote:

Hi,

I am new to scheme scripting. What i want to do is open pictures from a directory and apply a very simple macro.

I can do it manually with the following steps : - open image "the_image.jpg".
- save as .... the_image_with_thumbnail.jpg - choose options : q = 0.85 , progressive, and default other options. - check the option : save thumbnail. - Click OK.
- close image.

Using a bash script or DOS batch file with imagemagick is a better and easier solution.

Below is a bash script that I use to create thumbnails of photos from my digital camera.
You can pass the jpg quality parameter to convert - I used the default which is 75% I think. The options are in the docs.

-----------------------------

#!/bin/bash

echo "Converting ..."

if [ ! -d "resized-1024x768" ] then
mkdir resized-1024x768
fi

if [ ! -d "resized-256x192" ] then
mkdir resized-256x192
fi

# Loop through all jpg files in current folder # ============================================ for i in *.jpg
do
FileName_Stripped=`echo $i | cut -d. -f1`

if [ ! -e "resized-1024x768/$FileName_Stripped-1024x768.jpg" ] then
echo "Converting $i to $FileName_Stripped-1024x768.jpg" convert -resize 1024x768
$i "resized-1024x768/$FileName_Stripped-1024x768.jpg" fi

if [ ! -e "resized-256x192/$FileName_Stripped-256x192.jpg" ] then
echo "Converting $i to $FileName_Stripped-256x192.jpg" convert -resize 256x192
$i "resized-256x192/$FileName_Stripped-256x192.jpg" fi
done

echo "Done"

-----------------------------

Thank you very much for pointing this tool to me. However ...
I can't find in imagemagick the ability to save thumbnail as EXIF data in the jpeg, and not in a different picture.

Guillaume Bonillo
2007-05-07 18:54:54 UTC (over 17 years ago)

Scripting - How to save JPEG with thumbnails

Guillaume Bonillo a écrit :

Paul Surgeon a écrit :

On Monday 07 May 2007 11:37, Guillaume Bonillo wrote:

Hi,

I am new to scheme scripting. What i want to do is open pictures from a directory and apply a very simple macro.

I can do it manually with the following steps : - open image "the_image.jpg".
- save as .... the_image_with_thumbnail.jpg - choose options : q = 0.85 , progressive, and default other options. - check the option : save thumbnail. - Click OK.
- close image.

Using a bash script or DOS batch file with imagemagick is a better and easier solution.

Below is a bash script that I use to create thumbnails of photos from my digital camera.
You can pass the jpg quality parameter to convert - I used the default which is 75% I think. The options are in the docs.

-----------------------------

#!/bin/bash

echo "Converting ..."

if [ ! -d "resized-1024x768" ] then
mkdir resized-1024x768
fi

if [ ! -d "resized-256x192" ] then
mkdir resized-256x192
fi

# Loop through all jpg files in current folder # ============================================ for i in *.jpg
do
FileName_Stripped=`echo $i | cut -d. -f1`

if [ ! -e "resized-1024x768/$FileName_Stripped-1024x768.jpg" ] then
echo "Converting $i to $FileName_Stripped-1024x768.jpg" convert -resize 1024x768
$i "resized-1024x768/$FileName_Stripped-1024x768.jpg" fi

if [ ! -e "resized-256x192/$FileName_Stripped-256x192.jpg" ] then
echo "Converting $i to $FileName_Stripped-256x192.jpg" convert -resize 256x192
$i "resized-256x192/$FileName_Stripped-256x192.jpg" fi
done

echo "Done"

-----------------------------

Thank you very much for pointing this tool to me. However ...
I can't find in imagemagick the ability to save thumbnail as EXIF data in the jpeg, and not in a different picture.

Ok, so if someone want to write Exif thumbnail to jpeg i've done this with imagemagik and exiftools to write thumbnail generated by imagemagik... Maybe there's a better way to do this but this tools works just as expected and there's no loss of other exif info.

But if someone ever got a scheme script to do that through GIMP ... i'am interested

Thanks list !

Sven Neumann
2007-05-07 22:14:49 UTC (over 17 years ago)

Scripting - How to save JPEG with thumbnails

Hi,

On Mon, 2007-05-07 at 11:37 +0200, Guillaume Bonillo wrote:

I am new to scheme scripting.
What i want to do is open pictures from a directory and apply a very simple macro.

I can do it manually with the following steps : - open image "the_image.jpg".
- save as .... the_image_with_thumbnail.jpg - choose options : q = 0.85 , progressive, and default other options. - check the option : save thumbnail. - Click OK.
- close image.

It's acutally a bad idea to do that. When you are opening a JPEG file and saving it again as JPEG, you are recompressing it and this recompression means a loss of quality. This can be avoided by using a tool that manipulates the JPEG file without recompressing the image data. Such tools are available and they can even rotate the image for you without decompressing the image data. See for example exiv2 (http://www.exiv2.org/). The manual page says that it can insert thumbnails.

Sven