Tips for Editing Product Images
Composition
Gordon Food Service has a nice guide for packaged and raw products. https://www.gfs.com/files/pdf/literature/gfsphotographystandards.pdf
Create Outlined Image in Gimp
If you don’t have proper lighting and backgrounds, it might be best to use an outline image with transparent background.
- Open in Gimp
- Layer
- Transparency
- Add Alpha Channel
- Transparency
- Scissor Tool
- Check Antialiasing
- Check Feather edges (8)
- Check Interactive Boundary
- Zoom in on Image
- Start clicking boundary points
- Click on the starting boundary point when done
- Click in center of scissor area to select it
- Click the Select Button
- Invert
- Click the Keyboard Delete Button to delete the background.
- Image button
- Autocrop Image
- Save a
.xcf
file for future editing - Export a
.png
file for use.
- Layer
Rotating Images in Gimp
- Tools Button
- Transform Tools
- Rotate
- Transform Tools
Trim or Autocrop Alpha Channel with ImageMagick
This automatically crops images from a transparent alpha channel background.
mogrify -trim +repage *.png
mogrify
is an ImageMagick command to modify images by overwriting the original. Make sure you have a backup.-trim
trims image edges.+repage
is needed or the command will cause offset issues.+repage
removes/resets the virtual canvas meta-data from the images. See more here*.png
applies actions to and overwrites all.png
files in the folder.
Resize Edited Photos With ImageMagick
Simple resizing.
mogrify -resize WxH *.png
mogrify
is an ImageMagick command to modify images by overwriting the original. Make sure you have a backup.-resize WxH
resizes an image toW
px in width andH
px in height.*.png
applies actions to and overwrites all.png
files in the folder.
To create images with the same canvas size. (useful for thumbnails or other such needs.)
mogrify -gravity center -background transparent -extent WxH *.png
mogrify
is an ImageMagick command to modify images by overwriting the original. Make sure you have a backup.-gravity center
centers the image inside the transparent background.-background transparent
makes the resulting canvas transparent.-extent WxH
Sets the canvas size toW
px in width andH
px in height.*.png
applies actions to and overwrites all.png
files in the folder.
Reduce File Size using PNGCrush
for file in *.png ; do pngcrush -brute "$file" "${file%.png}-crushed.png" && mv "${file%.png}-crushed.png" "$file" ; done
Delete Files with Name Containing “foo”
# try without -delete to see what it will apply to.
find -type f -name '*foo*' -delete
Rename Files by Appending “foo” to End
for file in *.png; do mv $file "${file%.png}-foo.png"; done
Rename Files by Removing “foo”
# "-f" to force rename files in current directory
rename -f 's/foo//' *.png
Rename Files Based on csv File
Will rename all files in folder from the first files.csv
column name to the second files.csv
column name. Useful when combined with the duplication script below. Based on http://askubuntu.com/a/438580
sed 's/"//g' files.csv | while IFS=, read orig new; do mv "$orig" "$new"; done
sed 's/"//g' files.csv
will remove the quotesIFS=,
split the input on “,”while read orig new; do ... done
will read each input line, split it on the value of$IFS
(a comma) and save the 1st field as$orig
and the rest as$new
mv "$orig" "$new"
will rename the files as requested
Duplicate a File N
Times
This will duplicate foo.png
N
times and name the files sequentially: foo-001.png
, foo-002.png
, … foo-N.png
.
for n in {001..N}; do cp foo.png foo-$n.png; done
Published: 2015-04-15