How to directly load a JPEG image directly from URL into Luxor

I have figured out how to load a PNG image directly into Luxor. My solution is crude but it works.

using Luxor
using HTTP
dir_temp_name = tempname()
println("dir_temp_name is ",dir_temp_name)
file_temp_name = HTTP.download("https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2@2x.png", dir_temp_name)
println("file_temp_name is ",file_temp_name)
board_img = readpng(file_temp_name)
rm(dir_temp_name)

But it turns out that the image I wanted to load from URL is a JPEG image

Original map URL is
“https: //i.imgur.com/DFyPjui.jpeg
Original Milky Way Coordinate URL is
“https: //upload.wikimedia.org/wikipedia/commons/1/12/Artist’s_impression_of_the_Milky_Way_(updated_-_annotated).jpg

And Luxor documentation says that it CANNOT handle JPEG

Any ideas on how I can load a JPEG file directly into Luxor?
I was thinking of a way to convert a JPEG file into a PNG file on disk first but I don’t know how to do so using Julia packages.

You can use Images to load and save files:

using Downloads
import Images
using Luxor

f = Downloads.download("https://upload.wikimedia.org/wikipedia/commons/1/12/Artist%27s_impression_of_the_Milky_Way_%28updated_-_annotated%29.jpg")

img = Images.load(f)
Images.save("/tmp/file.png", img)

@draw begin
    scale(0.1)
    rotate(π/3)
    placeimage(readpng("/tmp/file.png"), centered=true)
end

For those who are interested. This is how I finally solved my problem.

#=
    Read an PNG image from URL into Luxor
    requires package Luxor,HTTP
=#
function ReadPNGImgFromURL(url::String;verbose=false)
    function vprintln(args...)
        if verbose == true
            println(args...)
        end
    end
    local file_temp_name = tempname() * ".png"
    vprintln("file_temp_name is ", file_temp_name)
    HTTP.download(url, file_temp_name)
    local board_img = Luxor.readpng(file_temp_name)
    rm(file_temp_name)
    return board_img
end

#=
    Read an JPEG image from URL into Luxor
    requires package Luxor,HTTP,Images
=#
function ReadJPEGImgFromURL(url::String;verbose=false)
    function vprintln(args...)
        if verbose == true
            println(args...)
        end
    end
    local jpeg_filename = tempname() * ".jpg"
    vprintln("jpeg_filename is ", jpeg_filename)
    HTTP.download(url, jpeg_filename)
    # Now convert JPEG file into PNG file   
    local jpeg_img = Images.load(jpeg_filename)
    png_filename = tempname() * ".png"
    vprintln("png_filename is ", png_filename)
    Images.save(png_filename, jpeg_img)
    local board_img = Luxor.readpng(png_filename)
    rm(jpeg_filename)
    rm(png_filename)
    return board_img
end