my tutorials‎ > ‎

Image processing


             my tips with using digikam
             XnviewMP

image enhancing and tagging options in Linux (without wine)

 Application  Pro's  Con's
gwenview
  • with kipi-plugins there are many enhancing tools
  • batch conversion and resize dialogues can run at the same time as each other
  • folders are treated like as with a file browser, can move etc
  • need to have ability to make any plugin on the drop down menu into a button -at left
  • the dialogue from resize on left does not include quality bar but the one from plugins does!
  • drop-downmenus and chevrons are pits.
  • converting images (batch) you can't send to a "new" dir that hasn't been made (compare Picasa!)
  • no keyword tagging
digikam 2.6
  • assigning tags -with right-click select RECENT or from the caption/tag side panel -can just select tags and then select other images (or press Space if in View mode) and tags are applied (with auto apply enabled)
  • search tagged photos -click on tag filter at left sidebar (clipboard icon) to search any tag (or multiple) through all albums, or from the filter at right sidebar to search any tag of the selected album
  • searching albums is fast
  • properties at right are very full
  • rating with 1-5 stars and 9 colours, 3 flags
  • first/last image with bottom right buttons or home/end
  • geo-location tool is very cool, with marble or google maps, show two maps, drag images to the map
  • Maps (in center) show geotagged images as groups showing image count, which divide as you zoom in
  • select a geotagged image and hit M and the image's group is selected
  • edit window is full of options -drop down menu item opens to the side, scroll button on value, choose view of before/after 
  • add images to a queue for conversion/resize/edits -just drag a Batch tool into the Assigned tools box, adjust the tool, choose whether to overwrite files or make a new album, and Run it (add the Queue icons to the tool bar)
  • upload to Picasa web albums is smooth -use shortcut key (reassign F3 to Picasa export) to send selected images (but needs click on Start again for newly sent to upload)
  • Can make a slideshow of an album that shows through all its child albums
  • Full size preview, when zoomed in, the next image stays at the same zoom level
Albums
  • can't find Sort Albums in View menu (so categories is a redundant feature), and no themes are present except Default (Digikam 2.6)
  • different collections show together under My albums -can't switch between them to show different sets of albums
  • can you do native searches/tag filter in each collection without results showing for all "My albums"? no, filter includes ALL collections
  • "My Albums" under "My Albums" is redundant, why not just show collection names?
  • no Album Category chooser
  • cannot add images to a new album that is not a directory, can only move them -needs to have photo boxes in which to add images to regardless of album location (similar indeed to color labels, but then can have boxes button on sidebar).
  • where is the waste bin? or undo send to waste? KDE I guess which I don't run.
Tags
  • scrolling tags in the right sidebar is extra work.  Better if they make columns so that all are easily visible: the scroll button skips through columns. 
  • Why the huge icon by each tag?
  • clicking on tag check box is more figity than selecting a tag by clicking on its name! So name-buttons?
  • in view mode the tags attached to an image are not shown under the image, only in the sidebar (and can be hidden there)
  • no shortcut key for tags tab on right panel
  • why "My Tags" under "My Tags" ?? New tag "/tag" goes under "My Tags" not as another top level tag
  • cannot edit root tag name!  Or root album name.
  • need multiple select tags (or tag manager) to sort them out
  • tag shortcuts are worthless -how do you do that with 50 or so?  BUTTON NAMES would be nice.
Edit image
  • edit -can make toolbar buttons but need to open for every next picture, doesn't stick open at the side -make shortcuts to open them quickly. -but a lot nicer if there was B-C-G sliders next to image in View mode.
  • as with Gwenview, if you make a mistake in a batch process dialogue (from right click menu), you have to close it and re-open it to try again.
  • there's no right-click on an album and add to a queue, batch process has less-features.
Preview
  • can't progress images with scroll button in view mode -can by pressing Shift -scroll button is used when zoomed in, to scroll up/down, but why not give a user option to progress?
  • can't set the background colour (but can in edit dia) -I rely on gnome color chooser which I open and click apply every time I use Digikam.
Side panels
  • the side panels can't be shrunk between a fixed width and zero.
  • side panel needs to "go away" by clicking the thumbnail-side border (at center, a button on it) clicking the button at far left is not exactly on-the-way -a shortcut key can open the panel, but it can't hide it. Needs hide panel shortcut. -I use F to go full screen often and I have "1Star' and "No Star" buttons on the toolbar.
  • right panel uses horizontal scroll bar because content can't fit in narrow size -just makes more work, for example to clear the tag entry field with clear button at right.
  • color labels on caption/tag side panel are on drop-down list -not the same as the filter bar! Better to have them all shown, there aren't many to show.
  • a NONE button on the filter sidebar? -on bottom bar at center, "Reset all active filters".
Batch
  • the "close" button in Export to Picasa Dialogue stops the upload -Alt-Tab to return to Digikam window
  • Batch Process (rightclick on album) dialogue can't create a dir that doesn't exist and also gives no second chance, only to close it.
Geolocating
  • Search panel affects only the left-hand map? Need for a focus feature when using two maps side-by-side, so that the search panel can affect either map.
  • two-map buttons (horizontal, vertical) and one map button would be better than a Preference dialogue
showfoto
  • full of image enhancing tools all accessed from the menu bar (tools from digikam)
  • good for quick work on just a few images
  • nice tool tips info of images
  • no importing or organising of albums
  • no batch queuing or editing supported
  • another white-background image gallery!!
gthumb  
  • tagging is only by right-click, not available in left-hand panel
  • resize/conversion has no quality option -it's set in Preferences
F-spot
  • a photo-tagging browser tool and that's all
  • folder tree is ancient and tedious for expanding
  • has basic editing -but need to select tool for every pic, doesn't stick (ie not like Picasa)
shotwell 0.14
www.yorba.org/...
  • organises images by event as well as folders (in latest version)
  • uploads to quite a few web image hosting services
  • sorts by tags
  • various tools
  • very slow response time and eats the cpu due to constant checking of library
darktable 
  • looks nice
  • batch tagging and resizing? don't think so
kphotoalbum
  • has only organising, which I don't need as everything is already in sorted directories
XnView MP 5.1 
xnview.com..  
  • nice interface -everything is customisable with settings and css sheet
  • thumbs can be close together (minimal blank space)
  • many tools for image enhancement (rotate, flip, crop, resize, BCG, rgb, HLS in the view tab, plus all the effects in batch convert dialogue)
  • easy writing IPTC keywords to images via info pane, also right-click edit IPTC of multiple images is possible
  • can mark images with rating 1-5 star or color, also can tag images (set a "check") and then filter all tagged for temporary work
  • building thumbnails is very fast business and the database doesn't get very large (1.9 Gb for 30k images.. OK it's over 5GB now)
  • resize dialogue shows "after" image with file size
  • Categories can't search individual folders and filter/ search gets canceled by moving to another folder
  • geotagging seems to be absent and geo-coordinate editing not possible in Exif properties dialogue
  • can't upload to Picasa Web Albums
  • there's no progress bar when applying categories (keywords) to many images (I depend on my laptop's hdd lamp!)
  • new folders don't show up in the folder tree
  • lots of tools still to be re-added from XnView the predecessor of MP
  • can't drag and drop files to the folder tree
  • no albums as yet



Image conversion with digikam

Gwenview is also usable, with the plugins menu, but digikam offers a batch queue manager which can do much more

Method 1. select an album -directory- and RC >Batch Process >Image Effects/Recompress (no format conversion)/Resize

Method 2. select images (click on album header to select all) and add to a queue (Configure toolbar with the queue buttons or shorcut key, i.e. Q, for ease)
  • drag a Batch tool into the Assigned tools box, adjust the tool, choose whether to overwrite files or make a new album, and Run it 
  • other images can be added to another queue before a process has finished

Example: convert stills from HD video for showing/uploading (6Mb .png files in /Pictures/../NEW)
  • select PNG files and add to a queue and convert to jpeg's
  • then filter the album by mime type (PNG) and delete the PNG files (if necessary)
  • select all and batch rename, press F2, and thus "original" JPEG's are created
  • next, carry out any light enhancements, cropping, and/or just tagging and save changes to file
  • select all the images and add to a queue, select resize, 1200-1400 pix 85-90%, make a new album
  • once the images have been processed, the new album can be dragged over to the right directory in the collection
  • the album of "original" images can be backed up to removable media 
Digikam Wiki page kde.org/Digikam



Image conversion with mogrify (Imagemagick)

forget using the Xterminal, let's use Thunar custom actions!
  • Edit >Configure custom actions >click + to make a new action, name it "convert all png to jpeg", with this next line as the command:
  • mogrify -format jpg -quality 100 *.png
  • in Appearance Conditions tab, enter *.png;*.PNG [corrected!] and check "Image files"
  • also choose an icon for the action
try it out: click on a PNG file in thunar and execute... wham! Jpegs are made at 100% quality from all the PNG files in the directory and put beside them -or above them if sort by type.

Now to resize those JPEGs for quick-viewing or uploading tasks
  • make a new action, name it "resize all jpegs 1200p 90%", conditions *.JPG;*.jpg;*.jpeg;*.JPEG and the command as this next line:
  • mogrify -resize 1200x1200 -quality 90 *.jpg *.JPG
WARNING! this command will OVER-WRITE the image files so it's better done on copies of the originals put in a different directory too!  Or just copy the directories to another location to work in them.  1200x1200 ensures the max width OR height will be 1200pix. Just stating 1200 could leave you with some 1200 wide x1700 high images, for example.

If you need a custom action that can deal with only the selected files (and OVER-WRITES them), you can use something like:
  • mogrify -resize 800x800 -quality 96 %F
Let's do one that produces files with a suffix to the filename (it doesn't over-write them):
  • mogrify -resize 800x800 -quality 96 -format "jpg_1" %F
And how about with in infix, which will produce a new file "image_name.sm.jpg", like this
  • mogrify -resize 800x800 -quality 96 -format "sm.jpg" %F
There are some very useful scripts which open up a Zenity window in which you can choose several options like format to convert to and resize parameters -see here and search "image-ca" http://salinelinux...

OK, here's something good.  this is a mogrify command that will convert all images in a directory (you can make it selection-only too with %F on the end instead of file extensions) and put them into a new directory that hasn't yet been created (that I've named "reduced"). (check images and enter *.jpg;*JPG in appearance conditions)
  • mkdir reduced && mogrify -path reduced -resize 1200x1200 -quality 90 *.jpg *.JPG
Or you can make a command so that all images in the directory which you click on will be size-reduced and put in a new directory alongside the one you clicked, with something like, (check "directories" in appearance conditions)
  • mkdir %f_a && mogrify -path %f_a -resize 1200x1200 -quality 96 /%f/*{.jpg|.JPG}
Feel free to alter the new directory suffix (mine above is "_a" -it could be "_resized") and of course the mogrify arguments.

This one scans recursivley and resizes all the jpeg's in the sub-dir's of the dir your right click on, and puts them into new sub-directories -which means just two clicks (and potentially a long wait!) to produce small images from, say, a stack of original large images. (watch the cpu monitor to know when the mogrify process is finished)
  • for D in %f/* ; do mkdir "${D}"_a && mogrify -path "${D}"_a -resize '1200x1200>' -quality 95 "${D}"/*{.jpg|.JPG}; done
or
  • find %f/ -mindepth 1 -type d | xargs -n1 -I {} bash -c 'mkdir "{}_a" && mogrify -path "{}_a" -resize 1200x1200\> -quality 95 "{}/"*.{jpg,JPG}'

To do the above but to reduce the size of images in the directory, while overwriting the images, use this and click on the directory 
  • mogrify -resize 1024x1024 -quality 84 %f/*{.jpg|.JPG}
And to do that recursively, so as to resize all the images in however many sub-directories there may be (which I've found very useful)
  • find %f/ -type f -name "*.jpg" -o -name "*.JPG" -print0 | xargs -0 mogrify -resize '1024x1024>' -quality 84 {} \;


Using Digikam

My Digikam Assigned Shortcuts (can also add toolbar buttons)

 V  View Image -for ease of opening and returning to thumbnails   Alt-A   Invert selection    
In Edit
 M  Maps  2   Forward (browser style)   T  Show/hide the thumbbar
 T  Thumbnails  1   Backward   1  Brightness/contrast
 C
 or Space or Shift-scroll button
=next image
 F1   Export to Picasa Web Albums    2  Hue/saturation
 Z
 or Shift-Space =Previous image  F2   Geo-location tool   Ctrl-X  Crop to selection
 >  Zoom in  F3, N   Rename   Esc  closes the tool panel
 <  Zoom out  F   Fullscreen toggle    F4  closes edit window
 A  Open Albums on left panel  Q   Add to current queue      
 G  Open Tags on left panel  W   Add to new queue     Light table
 L  Open image on Light table  Ctrl-Q  Open batch queue manager   L  close the window 
 S  gpS, open image(s) in Geolocation tool        
  • Click album title bar =Select all / Click off the thumbnails =Deselect all
  • Click image, shift and arrows to select multiple images
  • F4 opens image editor
  • F5 jumps to top of album
  • F9 is slideshow
  • home/end -first/last image, pg up/pg dn -moves up/down the thumbs
  • Edit window "Forward/Backward" shortcuts are for next/previous! Light table has next/previous shortcuts (Ctrl-M for menu).
  • Geolocation window closes with Escape.

Select pics across multiple albums
  • easy as selecting images and assigning a "color label" to them (keep at least one color for temporary use) or a star
  • do this for images in different albums that you want to select together
  • then use the filter on the right bar to show only the images you just labeled (you will need to check View > Group Images > Flat list )
  • then select them all (click on the title bar) and do as you wish -tag, send to a queue, export to we album etc
  • alternatively, add images from different albums to a single queue  -but what if you want to add them all to another queue, or start over again?
Tips
  • Add Views icon to toolbar -use it to select how an album with child albums shows thumbnails, divided at albums or a flat list (all images together alphabetically)
  • Add "1 Star" and "No Star" buttons (can rename the text on them) to the toolbar -or whatever color labels you like.
  • Group thumbnails: drag an image thumbnail onto another one to group them together (or select multiple and right click >Group >group here), click the group icon on the top one to show them, click again to hide, right click 'ungroup' them -this is a way to group images in an album of the same view or place for example.
  • add the Maintenance icon to the toolbar -use for scanning new images to the albums.
  • edit images with "Enable non-destructive editing and versioning" checked in Configure so that originals will be kept.
  • add the thumbnails button to edit/light table windows.
  • in edit window add the Select Tool button for a quick tool selection drop-down.
Geo-Tagging
1. Geo-location filter at left pane, shows a map integrated with either kde's marble (world globe) or with G maps shows groups of geotagged images on a map with count of images, 
  • group divides into smaller groups as you zoom in
  • click on a group and its images' thumbnails are shown in centre pane
  • >>rectangle select: click-drag area to select multiple groups
  • images can be sorted youngest/oldest shown first
2. Geo-location in center pane: again a marble map globe or G maps, which shows geo-tagged images from the database in groups with image count
  • images shown on map will reflect what is filtered in the left pane
3. Geo-tagging window shows two maps which can move around separately, you just drag images to the map to geo-tag them.
  • select images from an album before opening the geo-tagging tool

   


Digikam automatically updates the "My Tags" list with any tags found in new images' IPTC data.
 
Whilst that is very handy, what if you save pics from the web which are full of useless tags?  It will be tiring to delete all the tags you don't need from those web pics and your Tags list (one by one!).  So I wouldn't save web pics into a Collection album.  Save them elsewhere, then you can remove all their tags before moving to an album.

Remove exif/iptc data with Imagemagick: 
  • make a Thunar custom action with, for just the iptc data (keywords etc.): ls | xargs mogrify +profile iptc
  • for all exif data: ls | xargs mogrify -strip
  • Warning! the ls function will apply the command to all files in the directory!
  • for applying only to the selected files use mogrify +profile iptc %F
  • there's also jhead, with the command to remove iptc data: ls | xargs jhead -di

Patches

dump picasa and windows files from photo directories!!!
warning: all Picasa directory specific files will be permanently lost!
find /media/FILES/ -type f -name ".picasa.ini" -print0 | xargs -0 rm
find /media/FILES/ -type f -name "Picasa.ini" -print0 | xargs -0 rm
find /media/FILES/ -type f -name "Thumbs.db" -print0 | xargs -0 rm


XnViewMP

Here're my tips about this outstanding image organising/editing software from Pierre Gougelet. 


Settings
Browser 
-Tooltips
<b>{Filename}</b><br> {EXIF:Date Taken [y-m-d_H:M]}<br>{Modified Date [y-m-d_H:M]} <br>{Size KB}K <br><i>{Categories}</i>
-Preview background color (select)

View > Info tab (shows image info on full screen view)

{File Index} - {Filename}

{Format} - {Size KB} KB - {Width}x{Height}

{EXIF:Exposure Time}/ {EXIF:Max. Aperture}/ iso{EXIF:ISO Value}

{EXIF:Date [Y-m-d_H:M:S]}

<i>{Categories}</i>

{Tag status}


set colours/opacity/position below


Thumbnail 
-Appearance
no shadow, no background, margin 4
-Overlay
select only Rating and Color Label
-Labels
name, modified, size, image properties, IPTC keywords

Metadata >IPTC/XMP
-import XMP comment or IPTC keywords to db (to get data from files which are browsed)
-export for writing out to files

Integration Settings
-select path of db
-use optimise db once in a while to clear up missing files or empty folders

Tips:
IPTC data is only imported to the db as you load the images from each folder, so if you want to build your db in one go, select a folder in your list in Tree and then press the Show sub-folders on the Tool bar, and wait for the loading bar to reach 100% before moving to another folder.

you can select multiple (or single) images and edit the IPTC data with the right-click context menu, which is useful for wiping all keywords.
Use the Categories in the Info pane to set keywords to multiple files (effects when clicking on the List again)

Grouping files for export or whatever:
1st off add the "Show tagged" "Select tagged files" and "Untag all" buttons to the tool bar, or make shortcut keys, then,
  1. select with mouse
  2. hit Space to tag/untag
  3. when done hit "show all tagged"
  4. Ctrl-1 to apply one star rating
  5. untag all
  6. move to next folder
Space      toggle tag
Ctrl-Space     show/hide tag box
Shift-Z     show tagged files
Shift-Space    select tagged
Shift-Ctrl-Alt-T  clear all tags or Shift-Z, Ctrl-A, Space
E open file in edit mode / in edit mode, opens Enhance colours
Ctrl-1 -5  apply rating
Ctrl-0 no rating
Shift-Ctrl-1 -5 apply color rating
Shift-Ctrl-0 no color rating

the shortcuts in blue are mine (Settings > Interface > Shortcuts)
in shortcuts, under View mode (full screen), set toggle tag to Space

Untag all only works when tagged files are shown


Also add the Select all button to the toolbar, it will be handy when your hands are off the keyboard. + show tagged, select tagged, untag all

Also useful on the tool bar: Layout >, Info pane >, clipboard > , rating stars, no rating, colour code etc

Multiple instances of files on the harddisk means multiple same images in search results...
But there's complete control over this (apart from removing directories from the disk) with the Cache DB page in Settings.  If you want to prevent certain folders' files having their IPTC keywords (as well as thumbnails) added to the database, exclude those folders on the 2nd tab.    It's not working!
If you browsed them already before excluding, then any IPTC "categories" will have been added to the db -but you can now exclude the folders and then locate their cached data on the 1st tab and delete the entries, finally clicking on Optimize.
^this means that the exclude only refers to thumbnails and not IPTC/XMP keywords.

Switching tabs: Ctrl-Tab to move to next tab, also Left/Right to move between tabs once focused and Tab to return to the browser thumbs - or, use the mouse scroll button on tabs.

To remove preview from info pane, uncheck "Preview as tab" on the Info pane menu and then close the pop-up pane.  To get only categories in the info pane, select a file so the info shows, scroll through info pane tabs to Categories and then uncheck "Use tabs" on the Info pane menu.

! Setting the save quality !
Make sure you test with some copies first to find out what % you need, so you don't overwrite originals losing image quality.
This setting is in the Batch Convert dialogue from the Tools menu in Browser, or under File menu > Formats in the Preview tab.

problems:
can't filter folders by category -category shows images from the whole db (but can type a category in the quick search bar)

images removed or renamed with another programme will still be found in the Xnviewmp db (as file names) but the thumbnails will be blank in Category view
solution: Settings >Cache DB >click on Optimize and OK

can't upload to Picasa Web Albums it appears, but there are some others like flickr

cannot create a new folder in the left pane favorites tree


Search Similar files tool
Find this on the Tools menu.  You can load files to compare with another directory for similar file name, file data or picture content.  When you have selected files and/or folders, hit OK and the tool searches.  The results show up in a new window, and similar files/photos sit side-by-side.  You can then copy/move/delete either one of them by buttons under the images above.  It would be nice if you could select all and copy but you can't!

Search for Originals on back-up media?
I wanted to use the Search similar files tool for this but it was going to take too much time, searching and copying files one by one from the search result.

So I got onto Stackoverflow and asked for help to make a script.  This script will take a list of file names in a file, search for them on a specific location, copy the files found to another location and report any files that were not found, printing those filenames to another file.  
Here's how:
  • Select your files in Xnviewmp that you want to find the Originals for and then copy their file names to clipboard (Edit > Copy to Clipboard > Selected file names)
  • leafpad /directory/my pictures/copylist paste that list into the file and save it
  • make the script leafpad ~/scripts/findcopypics with this content
#!/bin/bash

dir=somewhere/to/search/
dest=somewhere/to/copy/to/
toCopyList=/directory/my pictures/copylist 
notCopied=/directory/my pictures/missed

while read line; do
   find "$dir" -name "$line" -exec cp '{}' $dest \; -printf "%f\n"    
done < "$toCopyList" > cpList

 cat cpList "$toCopyList" | sort | uniq -c | sed -nr '/^ +1/s/^ +1 +(.*)/\1/p' \
    > "$notCopied"

  • save that file and make it executable chmod +x ~/scripts/findcopypics
  • plug in the back-up media if it's external and run the script with sh ~/scripts/findcopypics
  • thanks to Navaneeth Krishnan for his help with the script


Xnview UI colours
1. edit the style sheet
leafpad ~/.xnviewmp/style_sheet.qss
 
/*----pane separator color
QMainWindow::separator {
background: grey;
    width: 4px; /* when vertical */
    height: 4px; /* when horizontal */
}

/*---folder tree background
QMainWindow{
background-color: rgb(25, 25, 25);
   /*background-color: rgb(25, 25, 25);


/*---colour of info panel (except preview background)
QTreeView{
    background-color: rgb(20, 20, 20);
    alternate-background-color:  rgb(40, 40, 40);

/*---folder tree/info/category item text
QTreeView::item{
    color: rgb(160,160,160);
    border: 0px solid green;


/*---background colour around thumbs in file list
QListView{
background-color: rgb(30, 30, 30);
    border: 1px solid black;

thumbnail labels background set in Settings >Browser/File List >Default color

2. edit the style sheet
leafpad ~/.xnviewmp/xnview.ini

folder icons colours
find something like the following:
m_folderColor1=100 149 237
m_folderColor2=110 123 139
m_folderColor3=132 112 255
m_folderColor4=122 103 238
m_folderColor5=132 112 255

these are my quickly chosen values.
change RGB values as required and note that:
  1. =Top color of the gradient area
  2. =Bottom color of the gradient area
  3. =Outline color of the folder tab
  4. =Background color of the folder tab
  5. =Color of the left and right edges
you'll need to restart Xnview and might need to rebuild thumbnails to make folder icons change colours to what you set.

add this line below the folder colors to change colour of frame around a selected file:
SelBorderColor=119 136 153
although it doesn't seem to work for me!





see for more help with the style http://newsgroup.xnview.com/...

Č
ą
ď
david quinton,
Apr 13, 2013, 9:24 AM
ą
ď
david quinton,
Apr 13, 2013, 9:24 AM
ą
ď
david quinton,
Apr 13, 2013, 9:24 AM
ą
ď
david quinton,
Feb 14, 2013, 10:45 PM
Comments