2
$\begingroup$

Here is the problematic code,

g = Binarize@
   ImageResize[Rasterize[Plot[Sin[1 x], {x, 0, \[Pi]}]], {100, 100}];
Image`ImportExportDump`ImageWritePNG["D:\\g.png", g];
Image`ImportExportDump`ImageReadPNG["D:\\g.png"]

Now, I think an animated gif would demonstrate the weird buggy behaviour better.

enter image description here

Is it intended behaviour of undocumented ImportExportDump? Why do we need to Import twice to release the somewhat cache issue? What is the workaround if we want fast import and export PNG multiple times to same file path?

$\endgroup$
4
  • 2
    $\begingroup$ I cannot reproduce the issue in 13.3 (see gif). Also, does this answer help? Although it seems Image`ImportExportDump`DeleteCachePNG[] is not available in v13 anymore ... Hmm ... $\endgroup$
    – Domen
    Jan 11 at 12:28
  • $\begingroup$ @Domen Saves my day! Thank you so much! ImageImportExportDumpDeleteCachePNG[] works on 13.2. But I am wondering why you can't reproduce it. $\endgroup$
    – matheorem
    Jan 11 at 12:34
  • $\begingroup$ @Domen You are right. I checked DeleteCachePNG is removed right after version 13.2. They probably integrate DeleteCachePNG[] into ImageReadPNG now. $\endgroup$
    – matheorem
    Jan 11 at 13:22
  • $\begingroup$ That was my thought exactly, yeah. Nice catch. I guess you should write an answer about this find :) $\endgroup$
    – Domen
    Jan 11 at 13:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.