[Gimp-developer] batch script for converting from xcf to jpg (was Re: GIMP 2.9 XCF files and digiKam, gnome file browsers, etc)



On 01/04/2016 05:50 AM, Boudewijn Rempt wrote:
On 01/03/2016 03:04 AM, Boudewijn Rempt wrote:
On Sat, 2 Jan 2016, Elle Stone wrote:

Digikam actually has't got to implement anything itself for that to
work. The thumbnails are generated by KIO plugin, the full image view by
QImageIO plugins. Check git://anongit.kde.org/kimageformats for the
imageio plugins (I should move the Krita imageio plugins there...) and
https://quickgit.kde.org/?p=kio-extras.git&a=tree&h=d2127aa55d72bfde4c269c75a91a721159548ff6&hb=3d8409f93830cb9bf658bd0648b7b1db3dd5c684&f=thumbnail
for the thumbnailers.


Boudewijn, thanks! for the information. On KDE bugzilla, would a
request for supporting GIMP 2.9 XCF files go under "product: kdelibs,
component: kimgio"?

I think it's rather frameworks-kimageformats

Is there any kind of concensus as to whether the GIMP 2.9 XCF file
format stable enough that it would it be worth filing a bug
report/enhancement request for support for GIMP 2.9 XCF files?

I don't know :-) I would personally wait until the stable release.


AFAIK the release date for GIMP 2.10 hasn't been set, and I'm pretty sure my own coding skills aren't up to the task of writing c++/qt5 code that allows KDE applications to open 2.9 XCF files.

As showing actual thumbnails for GIMP 2.9 files isn't yet possible, the next best thing is a companion "XCF sidecar" jpg file for digiKam (or other image viewer) to catalog. I found a batch script here:

http://stackoverflow.com/questions/5794640/how-to-convert-xcf-to-png-using-gimp-from-the-command-line

Here's code to run from a GIMP 2.9 prefix to convert XCF files to jpegs with the extension ".xcf.jpg":


$PREFIX/bin/gimp-2.9 -n -i -b - <<EOF
(let* ( (file's (cadr (file-glob "*.xcf" 1))) (filename "") (image 0) (layer 0) )
  (while (pair? file's)
(set! image (car (gimp-file-load RUN-NONINTERACTIVE (car file's) (car file's)))) (set! layer (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE))) (set! filename (string-append (substring (car file's) 0 (- (string-length (car file's)) 4)) ".xcf.jpg"))
    (gimp-file-save RUN-NONINTERACTIVE image layer filename filename)
    (gimp-image-delete image)
    (set! file's (cdr file's))
    )
  (gimp-quit 0)
  )
EOF

Having to do this one folder at a time would be not much fun. How should the code be modified to recursively travel through folders?

Best,
Elle



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]