Linux Lite Forums

Software - Support => Tutorials => Topic started by: m654321 on September 21, 2017, 05:48:03 AM

Title: Converting image file formats, e.g. *.png to *.jpg
Post by: m654321 on September 21, 2017, 05:48:03 AM
The other day, while using LL3.6, I needed to convert a *.png image file to an *.jpg one, before I could upload it to a website. I found the solution and thought I would share it with you - it's dead easy, which is what I like ...  ;)

It works in the terminal, through the imagemagick application (which is pre-installed on LL3.6), as far as I'm aware.

1. Open terminal
2. Type:
Code: [Select]
convert image.png image.jpg... where "image" is the name of your image file

However, you will need to indicate where image.png is located.  For example, if it is in 'Downloads' folder, then type:
Code: [Select]
convert /home/[username]/Downloads/image.png image.jpgIt will then leave an image.jpg version of the file in 'Downloads', alongside the image.png one.

Other information:
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: TheDead on September 21, 2017, 12:27:08 PM
Nice!
I usually use Gimp. But this is cool.

It's like having a scanner plugged in and works right away... take THAT Bill!
No drivers-fidling session.
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: m654321 on September 21, 2017, 03:15:14 PM
@TheDead
Glad it was useful  ;)

Mike
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: Moltke on September 21, 2017, 05:11:29 PM
Hi. Another way to do this is by selecting the *png file, right click on it and then select save a copy, in the saving window simply name the file adding the *jpg extension and save it, that's it.  ;D
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: TheDead on September 21, 2017, 05:31:42 PM
@Moltke
Dunno about this on, maybe it just renames the file with another extension.
ADD : Just tried it, I dont have "Save a copy' in my Linux Lite 3.6, just "Create a backup copy" that clones it.
(insert Twilight Zone music)
or you just have an add-on ;)

Cheers!
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: Moltke on September 21, 2017, 05:48:55 PM
@Moltke
Dunno about this on, maybe it just renames the file with another extension.
ADD : Just tried it, I dont have "Save a copy' in my Linux Lite 3.6, just "Create a backup copy" that clones it.
(insert Twilight Zone music)
or you just have an add-on ;)

Cheers!
Yes my bad. I just checked and for "save a copy" you have to open the *png file in ristretto, click on "file" menu and there it is; "save a copy" then simply when saving rename it adding the *jpg extension and that's it. Guess I forgot this "little" detail. Sorry about that  ;)
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: m654321 on September 22, 2017, 01:47:56 AM
Hi. Another way to do this is by selecting the *png file, right click on it and then select save a copy, in the saving window simply name the file adding the *jpg extension and save it, that's it.  ;D

Are you sure that renaming a file =  converting the file format?
I'm certainly no expert by any measure, but this doesn't seem right. Following the same logic one could suffix linux driver names with *.exe to make them work in Windows, which of course is not the case....

Could someone with some knowledgeable overview on this please comment?
I don't mean any disrespect towards you Moltke, whatsoever, when I say that and I hope it doesn't come across that way - I may well be incorrect with the comment I've made.

Many thanks
Mike
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: Moltke on September 22, 2017, 06:53:55 AM
Hi. Another way to do this is by selecting the *png file, right click on it and then select save a copy, in the saving window simply name the file adding the *jpg extension and save it, that's it.  ;D

Are you sure that renaming a file =  converting the file format?
I'm certainly no expert by any measure, but this doesn't seem right. Following the same logic one could suffix linux driver names with *.exe to make them work in Windows, which of course is not the case....

Could someone with some knowledgeable overview on this please comment?
I don't mean any disrespect towards you Moltke, whatsoever, when I say that and I hope it doesn't come across that way - I may well be incorrect with the comment I've made.

Many thanks
Mike

hI @m654321
Well, first of all is not as simple as that, I forgot  and I did mentioned in another comment, that for that to work you have to open the *png file in ristretto then click on "file menu" select "save a copy", when saving rename the file adding the *jpg extension and that's it. It worked for me. However, I did noticed that ristretto doesn't recognize the new file as a *jpg file while image magick does. Regarding your coment "Following the same logic one could suffix linux driver names with *.exe" this won't work because an *.exe file has some other attributes/properties which you can't just change by renaming it. I know this method can work on certain file types like images and texts, at least in windows it is possible check this out https://www.techwalla.com/articles/how-to-convert-rar-to-cbr. I guess it should be possible in Linux too.  ;D
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: TheDead on September 26, 2017, 11:17:30 AM
Yes my bad. I just checked and for "save a copy" you have to open the *png file in ristretto, click on "file" menu and there it is; "save a copy" then simply when saving rename it adding the *jpg extension and that's it. Guess I forgot this "little" detail. Sorry about that  ;)

NP, I'll have a look at Ristretto in the future. I havent really looked for a quick viewer, I've been using xnview for year on 'doze, one of the first program I usually install to replace the too-basic one in this OS ;)
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: m654321 on September 26, 2017, 11:34:17 AM
Hi. Another way to do this is by selecting the *png file, right click on it and then select save a copy, in the saving window simply name the file adding the *jpg extension and save it, that's it.  ;D

Thanks Moltke - I overlooked that detail - thankyou for pointing it out to me as I didn't know about that option.
I quite like the terminal method for changing the image format as it's so simple & direct.
I mentioned batch files in post #1 - do you know if Ristretto can also convert the format of those too?

Cheers
Mike
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: Moltke on September 26, 2017, 08:40:49 PM
Hi. Another way to do this is by selecting the *png file, right click on it and then select save a copy, in the saving window simply name the file adding the *jpg extension and save it, that's it.  ;D

Thanks Moltke - I overlooked that detail - thankyou for pointing it out to me as I didn't know about that option.
I quite like the terminal method for changing the image format as it's so simple & direct.
I mentioned batch files in post #1 - do you know if Ristretto can also convert the format of those too?

Cheers
Mike
You're welcome! I do agree with you about the terminal method being simpler and direct, I only thought of sharing the "save a copy" method with ristretto too, not because I think it's better but because it's possible. Regarding your question about Ristretto being able to convert between formats, according to this manual https://docs.xfce.org/apps/ristretto/getting-started seems it's not meant for converting images. However, I did changed the *.png extension to *.jpg but it didn't recognize it as a *.jpg img while image magick did. If I right click the *jpg img and check its properties it does says it's a *.jpg file though.
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: whateverthing on September 28, 2017, 12:39:25 PM
Regarding whether "save a copy" in Ristretto actually converts the file:

I don't have the system in front of me. But if a .PNG is converted to a .JPG, the .JPG file should be noticeably smaller. So if the two files (before and after) are exactly the same size, then I'm pretty sure no conversion took place.
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: smhardesty on September 28, 2017, 01:19:10 PM
Can't say for sure about Ristretto, but I do know that Mirage will convert from one file type to another when choosing to "save as" and then change the extension type.
Title: Re: Converting image file formats, e.g. *.png to *.jpg
Post by: NN on May 14, 2018, 04:45:03 PM
...