I'm trying to export images to a twitter account with mathematica and the quality of the images is rather disappointing.

enter image description here

Here are the others in case you want to see it in the wild: here

This is the code I use to export.

ServiceExecute[twitter, "ImageTweet", {"Image" -> plot}]

Where plot is the output of a simple ListLinePlot function. Cannot find any documentation about this. I tried making the image larger but that only made for a larger and uglier post. Any help is appreciated.

As per comments, the rasterized image looks like this when exported to my computer:

enter image description here

but if I tweet the image the result is quite ugly:

enter image description here

I didn't add a mwe before since you need a tweeter account to try it, but here it is:

twitter = ServiceConnect["Twitter"]
plot = Rasterize[
  ParametricPlot[{Sin[t], Cos[t] + Sin[\[Pi] t]}, {t, 1, 10}, 
   Axes -> False, AspectRatio -> 1, Background -> Hue[color], 
   ImageSize -> Large], RasterSize -> 2000, ImageSize -> 800]
ServiceExecute[twitter, "ImageTweet", {"Image" -> plot}]
  • 3
    $\begingroup$ Why not use Rasterize[] first to ensure an image of known resolution is being tweeted? $\endgroup$ May 20, 2016 at 3:06
  • 2
    $\begingroup$ In the absence of further information, I don't see how we can judge what makes an image "disappointing," so the advice by @J.M. is the only safe answer. If this doesn't work, you'd have to supply a MWE in Mathematica code. $\endgroup$
    – Jens
    May 20, 2016 at 4:13
  • $\begingroup$ @Jens I hope now it's clear what I mean by disappointing images. I wonder if this is a tweeter or mathematica issue. $\endgroup$ May 20, 2016 at 6:36
  • 3
    $\begingroup$ You should always give "Image" as the second argument to Rasterize for preserving quality on export, see here detailed explanations. But it does not explain the catastrophic loss of the quality in your case; looks like your image is tweeted in a lossy JPEG format. $\endgroup$ May 20, 2016 at 7:25
  • $\begingroup$ Can you show me the actual image and the one that is being uploaded to twitter? Also which version of Mathematica are you using? And what is PacletInformation["ServiceConnection_Twitter"] gives you? $\endgroup$
    – dsingh
    May 20, 2016 at 21:14


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.