What image formats do you use? I see you are writing a PNG, that can be both a paletted image and a non-paletted image. What formats do you read?

I don't know why the output is PNG. As I said in the original question, this is old code that is being refactored. As the images are all real pictures of properties and the like, it would be much better if they were JPGs but that means changing lots of other code where they are read. I will be changing all the PNG files to JPG files, probably manually, and then updating the code that reads the files then revisiting this code that writes them to ensure in future everythings is JPG. But that's for another time.

The input file is a stream from a website upload. The format could be any image format although practically it is likely to be a JPG as most of them will have originated from a digital camera which mostly produce JPG files.

Call isTrueColor() on your GD objects, should return true

A call of $image->isTrueColor() immediately before writing to the file does indeed return true.


In reply to Re^4: GD colorAllocate not changing colour by Bod
in thread GD colorAllocate not changing colour by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.