Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6870683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:42:46+00:00 2026-05-27T03:42:46+00:00

Here’s a challenge to all mathematica tag followers. Let’s make it a lot more

  • 0

Here’s a challenge to all mathematica tag followers. Let’s make it a lot more convenient to insert images into SO post from Mathematica by creating an imgur uploader.

How can we create a function imgur[g_] that will rasterize its argument (making sure that the final size is not wider than the width of StackOverflow posts), convert it to PNG, upload it to imgur, and return a ready to be pasted MarkDown line such as ![Mathematica graphic](http://i.imgur.com/ZENa4.jpg) ?

Useful references:

  • Imgur API
  • Example of using POST request from Mathematica on WRI blog (posting to Twitter) by ragfield
  • Example of using POST requests from Mathematica on SO (uploading to ifile.it)

I failed to adapt this latter method to uploading an image without exporting it to a file first.


Warning, use with care! StackOverflow uses a separate imgur installation that keep images indefinitely. If you use the main imgur, the images will disappear after 6 months if no one views them. Unfortunately as of 2011 November there seems to be no official way to upload images to StackOverflow programmatically.


Update: See below a solution for uploading to StackOverflow directly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:42:47+00:00Added an answer on May 27, 2026 at 3:42 am

    A little bird just informed me of a Mathematica solution to this question (the underlying implementation still uses JLink, but this answer hides all the java related code):

    imgur[expr_] := Module[
     {url, key, image, data, xml, imgurUrl},
     url = "http://api.imgur.com/2/upload";
     key = "c07bc3fb59ef878d5e23a0c4972fbb29";
     image = Fold[ExportString, expr, {"PNG", "Base64"}];
     xml = Import[url, 
      "XML", "RequestMethod" -> "POST", 
      "RequestParameters" -> {"key" -> key, "image" -> image}];
     imgurUrl = Cases[xml, XMLElement["original", {}, {string_}] :> string, 
      Infinity][[1]];
     "![Mathematica graphic](" <> imgurUrl <> ")"
    ]
    

    This is V8 only and the XML import options "RequestMethod" and "RequestParameters" are undocumented and experimental (and therefore subject to change).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here is my program to find all the subsets of given set. To solve
Here is my code sample, let me know if it can be further improved?
Here an example of my checkbox list http://jsfiddle.net/YnM2f/ Let's say I check on G
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here's a coding problem for those that like this kind of thing. Let's see
Here's the thing: I want to add some images programmatically. The images should have
Here's some CSS and HTML to make a textarea below a list of data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.