cancel
Showing results for 
Search instead for 
Did you mean: 

File Conversion

Community Veteran
Posts: 8,616
Thanks: 960
Fixes: 9
Registered: ‎02-08-2007

File Conversion

What's the easiest way to convert a file from one format to another.
What I am trying to do is convert a PNG file to a JPEG File.
A quick search comes up with a number of ways with one showing a simple input filexx.png  output filexx.jpeg but this command was met with sudo apt-get install yagiuda ?
Is that correct or should I be taking a different approach to this ?
17 REPLIES
Community Veteran
Posts: 18,023
Thanks: 1,687
Fixes: 20
Registered: ‎06-11-2007

Re: File Conversion


(I would think that GIMP may have this facility.... if not ....  Cry  don`t cry....  Grin )
download and install Irfanview.  You will need to use WINE to get it to work on Linux
Open the PNG file,
Click FILE > Save as> then in the drop down box below you can choose the file extension you want.
Should be saved in the original folder location, with the new extension.
(I would think that GIMP may have this facility.... if not ....  Cry  don`t cry....  Grin )
Community Veteran
Posts: 8,616
Thanks: 960
Fixes: 9
Registered: ‎02-08-2007

Re: File Conversion

Come on, there must be an easier way than that !
linux
Grafter
Posts: 146
Registered: ‎23-08-2007

Re: File Conversion

The ImageMagick package performs image file conversions, among other things:
http://www.imagemagick.org/script/convert.php
Community Veteran
Posts: 5,472
Thanks: 292
Fixes: 4
Registered: ‎11-08-2007

Re: File Conversion

I use GIMP, just load your filename.png file, then SAVE AS filename.jpg
Community Veteran
Posts: 8,616
Thanks: 960
Fixes: 9
Registered: ‎02-08-2007

Re: File Conversion

linux/purleigh,
Thanks for that.
Community Veteran
Posts: 18,023
Thanks: 1,687
Fixes: 20
Registered: ‎06-11-2007

Re: File Conversion

Like I said.......... Roll eyes
Quote

(I would think that GIMP may have this facility.... if not ....  Cry  don`t cry....  Grin)
Community Veteran
Posts: 1,699
Registered: ‎30-07-2007

Re: File Conversion

I thought that png and jpg were essentially the same format (except that png has a transparent bit so that it doesn't have to display in a rectangle. Try simply changing the extension from filexx.png to filexx.jpg  Huh
John
edit: tried it and although it displays properly in preview my photo software wouldn't open it - sorry.
J
EDIT: but you can insert it into a document in the usual way.  Smiley
J
HighLordPhanty
Grafter
Posts: 54
Registered: ‎30-07-2007

Re: File Conversion

png and jpg are completely different formats.
png is lossless, jpg is lossy.
Changing file extensions is not clever
VileReynard
All Star
Posts: 11,191
Thanks: 305
Fixes: 11
Registered: ‎01-09-2007

Re: File Conversion

Quote
convert image.png image.jpg
works for me - although GIMP would do it better.

Ben_Brown
Grafter
Posts: 2,839
Registered: ‎13-06-2007

Re: File Conversion

You can always specify quality settings for convert:
convert -quality 91 image.png image.jpg

For most purposes it will be as good as GIMP, and a lot quicker. If you've got lots of images to change convert will be loads quicker.
Community Veteran
Posts: 1,699
Registered: ‎30-07-2007

Re: File Conversion

Quote from: HighLordPhanty
png and jpg are completely different formats.
png is lossless, jpg is lossy.
Changing file extensions is not clever


I'll consider myself chastised and go and sit on the naughty step.  Embarrassed
In fairness, I never said it was clever, only that it seemed to work, and if it didn't you only have to change the extension back again  Undecided
Ellis
Grafter
Posts: 213
Registered: ‎04-02-2011

Re: File Conversion

Quote from: HighLordPhanty
png and jpg are completely different formats.
png is lossless, jpg is lossy.
Changing file extensions is not clever

The only file extensions which I have found to be able to be swapped are .mov and .avi (both video files). Some applications will only handle one type, but I have found them to work if you swap extensions.
Community Veteran
Posts: 5,225
Thanks: 494
Fixes: 22
Registered: ‎10-06-2010

Re: File Conversion

.mov and .avi are also different file formats. Some software will not care about the file extension and detect the format based on the contents of the file.
VileReynard
All Star
Posts: 11,191
Thanks: 305
Fixes: 11
Registered: ‎01-09-2007

Re: File Conversion

Quote
Magic number
One way to incorporate such metadata, often associated with Unix and its derivatives, is just to store a "magic number" inside the file itself.
Originally, this term was used for a specific set of 2-byte identifiers at the beginning of a file, but since any undecoded binary sequence can be regarded as a number,
any feature of a file format which uniquely distinguishes it can be used for identification.
GIF images, for instance, always begin with the ASCII representation of either GIF87a or GIF89a, depending upon the standard to which they adhere.
The magic number approach offers better guarantees that the format will be identified correctly, and can often determine more precise information about the file.
Since reasonably reliable "magic number" tests can be fairly complex, and each file must effectively be tested against every possibility in the magic database,
this approach is relatively inefficient, especially for displaying large lists of files (in contrast, filename and metadata-based methods need check only one piece of data,
and match it against a sorted index). Also, data must be read from the file itself, increasing latency as opposed to metadata stored in the directory.
Where filetypes don't lend themselves to recognition in this way, the system must fall back to metadata.
It is, however, the best way for a program to check if a file it has been told to process is of the correct format: while the file's name or metadata may be altered
independently of its content, failing a well-designed magic number test is a pretty sure sign that the file is either corrupt or of the wrong type.
On the other hand a valid magic number does not guarantee that the file is not corrupt or of a wrong type.
So-called shebang lines in script files are a special case of magic numbers.
Here, the magic number is human-readable text that identifies a specific command interpreter and options to be passed to the command interpreter.
Another operating system using magic numbers is AmigaOS, where magic numbers were called "Magic Cookies" and were adopted as a standard system
to recognize executables in Hunk executable file format and also to let single programs, tools and utilities deal automatically with their saved data files,
or any other kind of file types when saving and loading data. This system was then enhanced with the Amiga standard Datatype recognition system.
Another method was the FourCC method, originating in OSType on Macintosh, later adapted by Interchange File Format (IFF) and derivatives.

See Wikipedia...