batch convert .xcf to .jpg - Resolved

Questions about applications and software
Forum rules
Before you post please read how to get help
swapper1937
Level 1
Level 1
Posts: 38
Joined: Wed Jan 01, 2014 7:53 am

batch convert .xcf to .jpg - Resolved

Postby swapper1937 » Sat Nov 07, 2015 11:47 am

I hope this is the correct forum?

I have just started using Gimp with Linux Mint 17. and have now got about 50 photos with the .xcf extention, I realise now that I should have exported them individually to jpg.

Any Ideas about what I can do please?
Last edited by swapper1937 on Sat Nov 21, 2015 12:04 pm, edited 1 time in total.

User avatar
Flemur
Level 11
Level 11
Posts: 3756
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: batch convert .xcf to .jpg

Postby Flemur » Sat Nov 07, 2015 12:27 pm

Code: Select all

$ gimp --help | grep batch
  -b, --batch=<command>               Batch command to run (can be used multiple times)
  --batch-interpreter=<proc>          The procedure to process batch commands with


Also, xnview can read XCF files and has a "Tools -> Batch convert" function.
Mint 18.1 Xfce/fluxbox/pulse-less - Xubuntu 16.10/fluxbox/pulse-less
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

User avatar
phd21
Level 10
Level 10
Posts: 3308
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: batch convert .xcf to .jpg

Postby phd21 » Sun Nov 08, 2015 12:34 am

HI swapper1937,

As user "Flemur" suggested, I would recommend installing 'XnViewMP", "XnConvert", and use either one to convert these in a batch process. "Gwenview" is another great program that can easily do this; browse to your images, highlight them, click "plugins", "batch processing", "convert images", and pick your format.

XnViewMP
http://www.xnview.com/en/xnviewmp/

Hope this helps ...
Phd21: Mint 17.3 KDE, 64-bit, Awesome, Dell OptiPlex 780 Core2Duo E8400 3GHz,3gb Ram,160gb hdd, Video: Intel 4 Series Integrated Graphics Controller, DVD Lightscribe.
Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

BenTrabetere
Level 4
Level 4
Posts: 241
Joined: Sat Jul 19, 2014 12:04 am
Location: Mississippi, USA

Re: batch convert .xcf to .jpg

Postby BenTrabetere » Sun Nov 08, 2015 2:26 am

I also recommend XnViewMP for converting image files. It is an image viewer with a basic set of image editing tools, and it has a batch conversion utility. I like and use XnViewMP for converting image files - it is fast and easy to use.


I also use the Imagemagick "convert" tool. If you don't mind working from a command line and you will convert files frequently, I think it is worth the trouble to learn to use. I find it converts files faster than XnView.

If you want to convert all of the XCFs in a directory to JPGs, open a terminal session, go to the directory where the files are located, and enter....

Code: Select all

find . -name "*xcf" | xargs -l -i basename "{}" ".xcf" | xargs -l -i  convert  "{}.xcf" "{}.jpg"



I am pretty sure Imagemagick is one of the programs that is installed with Linux Mint. If not, it is in the repository. I am amazed at how much image editing can be done from the command line.

swapper1937
Level 1
Level 1
Posts: 38
Joined: Wed Jan 01, 2014 7:53 am

Re: batch convert .xcf to .jpg

Postby swapper1937 » Sun Nov 08, 2015 3:16 am

BenTrabeter,

Thanks for your response, I ran the script provided

find . -Scanned "*xcf" | xargs -l -i basename "{}" ".xcf" | xargs -l -i convert "{}.xcf" "{}.jpg

Or have I missed something out?
The response I got was a long list, here are the first couple.

-i convert 20140710_180504.jpg.xcf 20140710_180504.jpg.jpg' @ error/convert.c/ConvertImageCommand/3044.
convert.im6: unable to open image `20140710_180455.jpg.xcf': No such file or directory @ error/blob.c/OpenBlob/2638.
convert.im6: no images defined `20140710_180455.jpg.jpg
find . -Scanned *xcf | xargs -l -i basename 20140710_180455.jpg .xcf | xargs -l -i convert 20140710_180455.jpg.xcf 20140710_180455.jpg.jpg' @ error/convert.c/ConvertImageCommand/3044.

However, I could not find any converted jpg's, should they have gone into the same folder as the .xcg's?

I installed xnview from the software manager but the screen (and the Linux display) kept freezing and I had to turn the pc off to reboot, I eventually uninstalled it after about four attempts to use it.

I have not tried xnviewmp yet/

Thanks again.

BenTrabetere
Level 4
Level 4
Posts: 241
Joined: Sat Jul 19, 2014 12:04 am
Location: Mississippi, USA

Re: batch convert .xcf to .jpg

Postby BenTrabetere » Sun Nov 08, 2015 10:11 am

swapper1937 wrote:Thanks for your response, I ran the script provided

find . -Scanned "*xcf" | xargs -l -i basename "{}" ".xcf" | xargs -l -i convert "{}.xcf" "{}.jpg

Or have I missed something out?


I will be of limited assistance on the command line errors. What I offered was a command that works for me. It is something I put together while trying to learn to use the command line, and it uses the shell commands find and xargs along with convert. If I were pressed, I would say I borrowed most of it from a tutorial I ran across.

Maybe someone with more experience can properly explain what is going wrong for you. What I think is....

1. You have to issue the command from the directory that contain the files you want to convert. Either change to the directory or open the folder in the file browser, right-click in an empty spot in the folder (i.e.,not on a file), and from the menu select Open in Terminal.

2. What is the -Scanned switch? Did you try using it with the -name switch?


As for XnViewMP, I suggest you download the appropriate (32-bit or 64-bit) .deb from the website.
http://www.xnview.com/en/xnviewmp/

User avatar
Flemur
Level 11
Level 11
Posts: 3756
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: batch convert .xcf to .jpg

Postby Flemur » Sun Nov 08, 2015 11:30 am

find . -Scanned "*xcf" | xargs -l -i basename "{}" ".xcf" | xargs -l -i convert "{}.xcf" "{}.jpg
Or have I missed something out?


Yes.
find: unknown predicate `-Scanned'
(it started out as "-name" ; probably should be "-iname")

Also missing a quote (") at the end. But the original script doesn't work anyway:

Code: Select all

find . -name "*xcf" | xargs -l -i basename "{}" ".xcf" | xargs -l -i  convert  "{}.xcf" "{}.jpg"

Tells me
convert: unable to open image `Untitled.xcf': No such file or directory @ error/blob.c/OpenBlob/2709.
convert: no images defined `Untitled.jpg' @ error/convert.c/ConvertImageCommand/3210.
("Untitled.xcf" is one dir level down)

If you use "convert" you might want to pass the
"-quality" param: "JPEG/MIFF/PNG compression level"
Mint 18.1 Xfce/fluxbox/pulse-less - Xubuntu 16.10/fluxbox/pulse-less
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

User avatar
austin.texas
Level 20
Level 20
Posts: 10265
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: batch convert .xcf to .jpg

Postby austin.texas » Sun Nov 08, 2015 12:24 pm

If you are using Cinnamon, you have Nemo as your file manager.
It is very easy to do batch conversions in Nemo. Just install nemo-image-converter. It is versatile and easy to use.

Code: Select all

sudo apt-get install nemo-image-converter

This package adds a "Resize Images..." menu item to the context menu of all images. This opens a dialog where you set the desired image size and file name.
A click on "Resize" finally resizes the image(s) using ImageMagick's convert tool.
Requires a re-boot after installing nemo-image-converter

For Caja, install:

Code: Select all

sudo apt-get install caja-image-converter
Mint 18.1 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Microsoft-free environment since 1996

Linux Linx 2017

BenTrabetere
Level 4
Level 4
Posts: 241
Joined: Sat Jul 19, 2014 12:04 am
Location: Mississippi, USA

Re: batch convert .xcf to .jpg

Postby BenTrabetere » Sun Nov 08, 2015 1:01 pm

Flemur wrote: But the original script doesn't work anyway:

Code: Select all

find . -name "*xcf" | xargs -l -i basename "{}" ".xcf" | xargs -l -i  convert  "{}.xcf" "{}.jpg"



??? It works for me. The script I use converts TIFs to JPGs, but I tested it on some XCFs and they converted without error. Where did I make a mistake?

I understand why it might be better to use -iname instead of -name, but I think the * wildcard should address any case issues.

I also understand the importance of using the -quality option. I use "convert" when I am working with 200+ 21MB TIFs, and typically I do two conversions - one high quality and one medium quality. For the high quality conversion I do not use the -quality parameter because I am satisfied with the default values. For the other conversion I use -quality 50 .


Where is my mistake and what can I do to correct it? Thanks

swapper1937
Level 1
Level 1
Posts: 38
Joined: Wed Jan 01, 2014 7:53 am

Re: batch convert .xcf to .jpg

Postby swapper1937 » Sun Nov 08, 2015 7:29 pm

Thanks everybody,

Because I don't know what I am doing in the terminal (I don't know what I am doing most of the time my wife says) I thought that:-
"-name" in the Script meant the name of the folder (scanned) in which my .xcf files were placed.

I am way out of my depth with the answers/suggestions given, I could not get a result with the Apps suggested which I did try.

In the end, I bit the bullet and using Gimp, I opened each .xcf file, one at a time, and then exported them as .jpg. about 50. long winded I know, but I got there in the end, it is a lesson well learned, export each picture as I use them.

Gimp is o.k. for me but I wonder why there is not a batch convert option for its .xcf files within that programme?.

I can't call this query resolved, even if the answer is within the suggestions provided, because I am unable to sort it out, no-ones fault but my own.

Anyway, thanks you all again.

User avatar
Flemur
Level 11
Level 11
Posts: 3756
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: batch convert .xcf to .jpg

Postby Flemur » Sun Nov 08, 2015 7:41 pm

In the end, I bit the bullet and using Gimp, I opened each .xcf file, one at a time, and then exported them as .jpg. about 50.


Next time (!)

gimp -> Filters -> Batch (near bottom of menu list ->"Davids Batch Processor"**) -> (make the window wide enough to see everything, it screws up) -> Input -> Tab(Add Files);
then
tab -> Ouput -> Pick jpg, set the values you want -> Start: makes a bunch of jpg files.

**Sounds like a plugin: gimp-plugin-registry and/or gimp-gmic
Mint 18.1 Xfce/fluxbox/pulse-less - Xubuntu 16.10/fluxbox/pulse-less
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

User avatar
phd21
Level 10
Level 10
Posts: 3308
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: batch convert .xcf to .jpg

Postby phd21 » Sun Nov 08, 2015 10:51 pm

Hi swapper1937, and anyone else interested in this,

There are numerous ways to convert images, videos, and audio, files from one format to another using nice simple Graphical (GUI) Linux desktop programs, as have already been mentioned in this post. This is a little unusual, because you are converting a specialized Gimp image file (.xcf), not a standard image file (.jpg, .gif, .png, etc...).

I am providing nice simple quick video tutorials below to show you how, for "Gimp" Batch Conversion, "XnViewMP" batch conversion, and "Gwenview" batch conversion processes. If you want to use the console terminal command line, you can. I do not use the command line unless I have to, and I'm good at it (ex-programmer & software developer). There are other programs like "converseen", "xnconvert", in the Software Manager or Synaptic Package Manager (SPM), & "format junkie", etc... that can also easily convert most normal images, and more.

To view the video(s), just click the picture below, or right click and open in a new tab.

gimp_batch_11-08-2015u.gif
"Gimp" video example of batch image conversion.


XnViewMP__batch_11-08-2015u.gif
"XnViewMP" video example of batch image conversion.


Gwenview__batch_11-08-2015u.gif
"Gwenview" video example of batch image conversion.


Hope this helps ...
Phd21: Mint 17.3 KDE, 64-bit, Awesome, Dell OptiPlex 780 Core2Duo E8400 3GHz,3gb Ram,160gb hdd, Video: Intel 4 Series Integrated Graphics Controller, DVD Lightscribe.
Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

swapper1937
Level 1
Level 1
Posts: 38
Joined: Wed Jan 01, 2014 7:53 am

Re: batch convert .xcf to .jpg

Postby swapper1937 » Thu Nov 19, 2015 4:03 am

phd21,

Thank you for your advice, I have just read it but not yet viewed, which I will in the next couple of days.
It seems rather rude of me to ignore any help given when it is asked for, but as I said, I have just read your response, please give me a few days to ssort myself out.

Thank you.

swapper1937
Level 1
Level 1
Posts: 38
Joined: Wed Jan 01, 2014 7:53 am

Re: batch convert .xcf to .jpg

Postby swapper1937 » Sat Nov 21, 2015 4:21 am

hello phd21

I have spent a couple of days trying to find "Batch" under filters of my Gimp 2.8,

I have also tried to find it for downloading, but no success as yet.
Just thought i would give you my latest.
Thanks

BenTrabetere
Level 4
Level 4
Posts: 241
Joined: Sat Jul 19, 2014 12:04 am
Location: Mississippi, USA

Re: batch convert .xcf to .jpg

Postby BenTrabetere » Sat Nov 21, 2015 11:33 am

swapper1937 wrote:hello phd21

I have spent a couple of days trying to find "Batch" under filters of my Gimp 2.8,


Open Software Manager and enter Gimp in the search field - gimp-plugin-registry should be near the top of the list. Install.

While you are there, you might consider installing gimp-data-extras, gimp-texturize and gimp-ufraw.

swapper1937
Level 1
Level 1
Posts: 38
Joined: Wed Jan 01, 2014 7:53 am

Re: batch convert .xcf to .jpg

Postby swapper1937 » Sat Nov 21, 2015 11:50 am

BenTrabetere,

Thank you. have done as you suggested and things are now fine.
I'm very pleased, thanks again.

swapper1937
Level 1
Level 1
Posts: 38
Joined: Wed Jan 01, 2014 7:53 am

Re: batch convert .xcf to .jpg

Postby swapper1937 » Sat Nov 21, 2015 12:03 pm

Excellent!

With the help of phd21's "Gimp" video, and BenTrabeter direction to the Gimp software, I have now batched .xcf files to ,jpg,

Thanks everyone.


Return to “Software & Applications”

Who is online

Users browsing this forum: paczes and 9 guests