Re: Issue with PNG and Blog inw Windows using MinGW64
Giovanni Remigi <[email protected]> Thu, 5 Jan 2017 10:24:23 +0000
| Newsgroups | gmane.comp.video.graphicsmagick.apis |
|---|---|
| Message-ID | <CACjhwVPh9VNDyQP7WFF_vee_f_F5FwFzNoj=qgkxpkk8_LuyOA@mail.gmail.com> |
--===============5329218885184096851== Content-Type: multipart/alternative; boundary=001a113ef06a22871a0545564e27 --001a113ef06a22871a0545564e27 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable >> I'm aware that GraphicsMagick does not support files containing UTF >> characters on Windows. I'm using GraphicsMagick as a DLL and If I try >> reading from such files my application crashes. > >By "UTF characters" do you mean UTF-16? GraphicsMagick can work ok >with UTF-8. What do you mean by "files containing UTF characters on >Windows"? Yes I meant UTF-16 on Windows e.g. "=C4=9F=C4=9E=C4=B1=C4=B0=C3=B6=C3=96=C3= =BC=C3=9C=C5=9F=C5=9E=C3=A7=C3=87.png". GraphicsMagick UTF-8 works perfectly on Linux and Mac but not on Windows. I searched for a while until I decided to go for the Blob workaround. > >> I found a workaround reading an image into a Blob using Qt and then read= ing >> the Blob from memory using GraphicsMagick. This works perfectly but I ha= ve >> an issue with the opposite operation writing a Blob into a file. >> >> When I encode an Image into a Blob in PNG format using Graphics Magick a= nd >> I write the Blob into a file using Qt I experience a data loss. The last >> part of the image appears black. >> The problem happens only *with big PNG* ( > 32MB) and* on WIndows only*, >> while on Linux it works perfectly. > >I don't know anything about QByteArray but it seems to me >that bytesWritten should equal blob.length() on success. I changed the code to check blob.length() as you suggested. When I'm trying to save a big image the number of bytes written is less than blob.length(). In fact the saved image is displayed with a big black band at the bottom. I'm not sure the reason. It happens only with big images and of course, on Windows only :-( Small images work fine. I wonder if there is a limitation on the max size of a blob object in memor= y. > >> I somehow blame libpng16. On Linux I use libpng12. Using the JPEG format= I >> do not experience data loss. > >Are you sure that your Qt build is using a consistent libpng version? >Is it possible that Qt is built against a different libpng than >GraphicsMagick was built against? It shouldn't matter. Qt simply transfer the blob from memory to file and from file to memory. It doesn't use libpng in this process. > >Bob >-- >Bob Friesenhahn >bfriesen@..., http://www.simplesystems.org/users/bfriesen/ >GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ --001a113ef06a22871a0545564e27 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_extra"><pre style=3D"margin-top:0px;ma= rgin-bottom:0px;padding:15px;border-width:0px 0px 0px 1px;border-top-style:= initial;border-right-style:initial;border-bottom-style:initial;border-left-= style:solid;border-top-color:initial;border-right-color:initial;border-bott= om-color:initial;border-left-color:rgb(229,229,229);outline:0px;vertical-al= ign:baseline;background-image:initial;background-position:initial;backgroun= d-size:initial;background-repeat:initial;background-origin:initial;backgrou= nd-clip:initial;word-wrap:break-word;overflow:auto"><font color=3D"#555555"= face=3D"monospace, sans-serif"><span style=3D"font-size:13px;white-space:p= re-wrap">>> I'm aware that GraphicsMagick does not support files = containing UTF >> characters on Windows. I'm using GraphicsMagick as a DLL and I= f I try >> reading from such files my application crashes. > >By "UTF characters" do you mean UTF-16? GraphicsMagick can w= ork ok=20 >with UTF-8. What do you mean by "files containing UTF characters = on=20 >Windows"?</span></font></pre><pre style=3D"margin-top:0px;margin-b= ottom:0px;padding:15px;border-width:0px 0px 0px 1px;border-top-style:initia= l;border-right-style:initial;border-bottom-style:initial;border-left-style:= solid;border-top-color:initial;border-right-color:initial;border-bottom-col= or:initial;border-left-color:rgb(229,229,229);outline:0px;vertical-align:ba= seline;background-image:initial;background-position:initial;background-size= :initial;background-repeat:initial;background-origin:initial;background-cli= p:initial;word-wrap:break-word;overflow:auto"><font color=3D"#555555" face= =3D"monospace, sans-serif"><span style=3D"font-size:13px;white-space:pre-wr= ap">Yes I meant UTF-16 on Windows e.g. "=C4=9F=C4=9E=C4=B1=C4=B0=C3=B6= =C3=96=C3=BC=C3=9C=C5=9F=C5=9E=C3=A7=C3=87.png". GraphicsMagick UTF-8 = works perfectly on Linux and Mac but not on Windows. I searched for a while= until I decided to go for the Blob workaround.</span></font></pre><pre sty= le=3D"margin-top:0px;margin-bottom:0px;padding:15px;border-width:0px 0px 0p= x 1px;border-top-style:initial;border-right-style:initial;border-bottom-sty= le:initial;border-left-style:solid;border-top-color:initial;border-right-co= lor:initial;border-bottom-color:initial;border-left-color:rgb(229,229,229);= outline:0px;vertical-align:baseline;background-image:initial;background-pos= ition:initial;background-size:initial;background-repeat:initial;background-= origin:initial;background-clip:initial;word-wrap:break-word;overflow:auto">= <font color=3D"#555555" face=3D"monospace, sans-serif"><span style=3D"font-= size:13px;white-space:pre-wrap">> >> I found a workaround reading an image into a Blob using Qt and the= n reading >> the Blob from memory using GraphicsMagick. This works perfectly bu= t I have >> an issue with the opposite operation writing a Blob into a file. >> >> When I encode an Image into a Blob in PNG format using Graphics Ma= gick and >> I write the Blob into a file using Qt I experience a data loss. Th= e last >> part of the image appears black. >> The problem happens only *with big PNG* ( > 32MB) and* on WIndo= ws only*, >> while on Linux it works perfectly. > >I don't know anything about QByteArray but it seems to me=20 >that bytesWritten should equal blob.length() on success.</span></font><= /pre><pre style=3D"margin-top:0px;margin-bottom:0px;padding:15px;border-wid= th:0px 0px 0px 1px;border-top-style:initial;border-right-style:initial;bord= er-bottom-style:initial;border-left-style:solid;border-top-color:initial;bo= rder-right-color:initial;border-bottom-color:initial;border-left-color:rgb(= 229,229,229);outline:0px;vertical-align:baseline;background-image:initial;b= ackground-position:initial;background-size:initial;background-repeat:initia= l;background-origin:initial;background-clip:initial;word-wrap:break-word;ov= erflow:auto"><font color=3D"#555555" face=3D"monospace, sans-serif"><span s= tyle=3D"font-size:13px;white-space:pre-wrap">I changed the code to check bl= ob.length() as you suggested. When I'm trying to save a big image the n= umber of bytes written is less than blob.length(). In fact the saved image = is displayed with a big black band at the bottom. I'm not sure the reas= on. It happens only with big images and of course, on Windows only :-( Smal= l images work fine.</span></font></pre><pre style=3D"margin-top:0px;margin-= bottom:0px;padding:15px;border-width:0px 0px 0px 1px;border-top-style:initi= al;border-right-style:initial;border-bottom-style:initial;border-left-style= :solid;border-top-color:initial;border-right-color:initial;border-bottom-co= lor:initial;border-left-color:rgb(229,229,229);outline:0px;vertical-align:b= aseline;background-image:initial;background-position:initial;background-siz= e:initial;background-repeat:initial;background-origin:initial;background-cl= ip:initial;word-wrap:break-word;overflow:auto"><font color=3D"#555555" face= =3D"monospace, sans-serif"><span style=3D"font-size:13px;white-space:pre-wr= ap">I wonder if there is a limitation on the max size of a blob object in m= emory.</span></font></pre><pre style=3D"margin-top:0px;margin-bottom:0px;pa= dding:15px;border-width:0px 0px 0px 1px;border-top-style:initial;border-rig= ht-style:initial;border-bottom-style:initial;border-left-style:solid;border= -top-color:initial;border-right-color:initial;border-bottom-color:initial;b= order-left-color:rgb(229,229,229);outline:0px;vertical-align:baseline;backg= round-image:initial;background-position:initial;background-size:initial;bac= kground-repeat:initial;background-origin:initial;background-clip:initial;wo= rd-wrap:break-word;overflow:auto"><font color=3D"#555555" face=3D"monospace= , sans-serif"><span style=3D"font-size:13px;white-space:pre-wrap">> >> I somehow blame libpng16. On Linux I use libpng12. Using the JPEG = format I >> do not experience data loss. > >Are you sure that your Qt build is using a consistent libpng version?= =20 >Is it possible that Qt is built against a different libpng than=20 >GraphicsMagick was built against?</span></font></pre><pre style=3D"marg= in-top:0px;margin-bottom:0px;padding:15px;border-width:0px 0px 0px 1px;bord= er-top-style:initial;border-right-style:initial;border-bottom-style:initial= ;border-left-style:solid;border-top-color:initial;border-right-color:initia= l;border-bottom-color:initial;border-left-color:rgb(229,229,229);outline:0p= x;vertical-align:baseline;background-image:initial;background-position:init= ial;background-size:initial;background-repeat:initial;background-origin:ini= tial;background-clip:initial;word-wrap:break-word;overflow:auto"><font colo= r=3D"#555555" face=3D"monospace, sans-serif"><span style=3D"font-size:13px;= white-space:pre-wrap">It shouldn't matter. Qt simply transfer the blob = from memory to file and from file to memory. It doesn't use libpng in t= his process.</span></font></pre><pre style=3D"margin-top:0px;margin-bottom:= 0px;padding:15px;border-width:0px 0px 0px 1px;border-top-style:initial;bord= er-right-style:initial;border-bottom-style:initial;border-left-style:solid;= border-top-color:initial;border-right-color:initial;border-bottom-color:ini= tial;border-left-color:rgb(229,229,229);outline:0px;vertical-align:baseline= ;background-image:initial;background-position:initial;background-size:initi= al;background-repeat:initial;background-origin:initial;background-clip:init= ial;word-wrap:break-word;overflow:auto"><font color=3D"#555555" face=3D"mon= ospace, sans-serif"><span style=3D"font-size:13px;white-space:pre-wrap">>= ; >Bob >--=20 >Bob Friesenhahn >bfriesen@..., <a href=3D"http://www.simplesystems.org/users/bfriesen/">= http://www.simplesystems.org/users/bfriesen/</a> >GraphicsMagick Maintainer, <a href=3D"http://www.GraphicsMagick.org/= ">http://www.GraphicsMagick.org/</a> </span></font></pre> </div></div> --001a113ef06a22871a0545564e27-- --===============5329218885184096851== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot --===============5329218885184096851== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Graphicsmagick-apis mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/graphicsmagick-apis --===============5329218885184096851==--