title: How to convert an uploaded file (InMemoryUploadedFile) from pdf to jpeg in Django using wand?
body: <p>I'm trying to convert a pdf file uploaded in Django to a jpg file. I would like to use the file directly in the InMemoryUploadedFile state. </p>
  
  <p>I tried to use wand but without any success. 
  Here is the code I wrote:</p>
  
  <pre class="lang-py prettyprint-override"><code>from django.shortcuts import render
  from wand.image import Image as wi
  
  # Create your views here.
  def readPDF(request):
      context = {}
      if request.method == 'POST':
          uploaded_file = request.FILES['document']
          if uploaded_file.content_type == 'application/pdf':
              pdf = wi(filename=uploaded_file.name, resolution=300)
              pdfImage = pdf.convert("jpeg")
      return render(request, 'readPDF.html', {"pdf": pdfImage})
  </code></pre>
  
  <p>I tried different things like using uploaded_file.file or uploaded_file.name as the first argument for the wand image but without any success.`</p>
  
  <p>I thank you in advance for your help!</p>