SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Png but Jpeg

  1. #1
    SitePoint Addict
    Join Date
    May 2007
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Png but Jpeg

    Hello. This page is a png image file. But when it is tried to save, the file is saved as jpeg rather than png. What causes this difference?

    Thanks.

  2. #2
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Perhaps the person who created it did so as a JPEG file and just renamed it to PNG for some strange reason.

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's served with a MIME type of image/png, so it has to be a PNG image or browsers wouldn't be able to render it.

    If I right-click and choose 'Save Image', or use the File/Save As menu option, Opera suggests saving it with a .png extension. So I think this might be a bug in your browser.
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Addict
    Join Date
    May 2007
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks AutisticCuckoo. You are right. I am using Firefox and it saves as jpeg. BTW, how do you get the Mime-type of the image?

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In Opera I just use the Info panel. I think in Firefox you need some extension or other. Isn't there one called 'Live HTTP headers' or something like that?

    The attached screenshot shows the Info panel for that image. It's in Swedish (sorry), but I think you can guess what most things mean.
    Attached Images Attached Images
    Birnam wood is come to Dunsinane

  6. #6
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    The image is really a JPEG image. What is going on it seems is the browser is getting errors when trying to use it as a PNG so it disregards the mime-type and uses the header in the file. The header is similar to this (removed unprintable chars [-]):
    Code:
    ---JFIF---CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    Firefox and IE both are saving the file as it really is, a JPEG.

    A PNG file would of course have a header similar to:
    Code:
    -PNG
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •