1
$\begingroup$

I cannot export a list of images (or a single image) to GIF format. I use Win10 with Mathematica 9.0. It previously worked on an other device with Win7. I can also export an image to other formats, like PNG or JPG.

Export["file.gif",image] produces an output which cannot be opened with anything (Windows Images, Paint, or any browser, ...). Export["file.png",image] works well.

Sorry if it's a common problem, but I haven't found an answer here.

An example code:

image = Plot[x, {x, 0, 1}];
SetDirectory[NotebookDirectory[]];
Export["file1.gif", image]
Export["file2.jpg", image]
$\endgroup$
9
  • $\begingroup$ I export to gif all the time, on windows 10. But I use V 12.1. No problems (other than it can slow). Can you post complete MWE where it fails? are you exporting frames of images or single image? $\endgroup$ – Nasser May 26 '20 at 11:28
  • $\begingroup$ @Nasser I posted an expamle. It is only a single image, but I still cannot open the gif file, while I can the jpg. Is it possible that the problem isn't on Mathetmatica's side? $\endgroup$ – Tomi27 May 26 '20 at 11:41
  • 3
    $\begingroup$ it works OK on my end. exported OK, opened image using paint.exe, all ok. So have no idea why it fails for you. May be problem with V 9. I do not have that on my PC now to try it. $\endgroup$ – Nasser May 26 '20 at 11:47
  • $\begingroup$ Try wrapping the plot with Image[...] and removing the alpha channel, then exporting it. image = RemoveAlphaChannel[Image[Plot[x, {x, 0, 1}]], White] $\endgroup$ – flinty May 26 '20 at 13:10
  • $\begingroup$ @flinty I tried your suggestion, but the problem remained the same. $\endgroup$ – Tomi27 May 26 '20 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.