common-lispjpegclisp

How to create jpeg image from base64 string in Common Lisp


I am working on a third-party application in Common Lisp. The server has a rest API that returns in response the profile photo of the account owner in base64 encoded format. I want to encode the image in jpeg using that base64 string and store it in local storage.

I use cl-jpeg package for creation of image. The package has an 'encode-image' function that takes the target file path, image array, height, width, and number of components.

When I call this function with a byte array created from a base64 string, the function creates a distorted image.

You can try the below example code:

(let* ((base64-string "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAEsASwDASIAAhEBAxEB/8QAHQAAAgMAAwEBAAAAAAAAAAAAAAcFBggDBAkCAf/EAFQQAAEAAAsSBw8DAwQDAAAAAAAGBxESExQWRYPCwwgVFxhERmFkZWaChKOkpeHi4wECBUNiZ8EDBCEkJSZBQmOBhaGixOQJMVEZI3IiMkemJ3GR/8QAHAEAAgMBAQEBAAAAAAAAAAAABQYDBAcIAgEA/8QAUREAAAMFAgcIDQoGAQQDAAAAAAERAgMEBRIGMRMUFSFBUaEWUmGBgqKx0QciMjM0NUJTYmOyweEXI0NEZHGDwtLiNlSjs8PwJAglcvEmReP/2gAMAwEAAhEDEQA/ANqgAFsY+L4la+cDHL4UNK184GOXwqvO6MaNIfF7vj9owGYjTpmIMSby+L3g27AJOaTrdxyRHYJOaTrdxyRDpC9Bd/Z4+gJMAA9A8NKgAGTjhoUVNB7IaIUQvaaD2Q0Qog/STwF3x9Jjr7sXfwnCfif3WwHXOwdctRWgUeyN9W5f5AEpyJz2D2kWSnInPYPaeYTvxf7oCLJvDWOPoMSgAAaD0NYAAGXh1EEiipsOKQJPIoqbDikCaVZ/xc74/aMcs9kf+Jonkf22ACyGaLIQuyb9V5f5AMs99Jx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Jf8Aa/6f7xt+a3rUx6QM8Dn/AE/K/fhf3Rr8Z5davIMMzL8DXQuepFUzaupPWl4Vpk93NxLUsSuhO27laiJq7OiKl482R8Grj4J3tpMuJ81RR6SqvEWoZ1bOQ7ucB85gsFVorWunhZRKeFV0IMqAarAhwvAEf5Ivtn9P948xAADoULYYiUb7QEoMQXaUb7QEoMQ59tx4+f8AJ9hkbhY/xK55XttAMrmqDK4KlXl8XvBWP8nj9wBvJAP9isqKEbyQD/YrKnqd+AvOLpIAJp4I3xdJBugACCFEdIAA6DHRAg0TVNhxSDJxE1TYcUgxBnfhzzi6CGV2k8ZveT7JAO0dU7Qfsh9NyfzDPLR/Rcr3ALolw+MDHKWXRLh8YGOEbW+Jn3J9tkE+xr/FELy/7bYugABio6sGqAAAwMUEbyzzOF2EYSfLPM4XYRhcddwQ9EAQ4+BDhuVeXxe8ZJ2U/qn4n5AFjQhVcHGK4WNCFVwcYitH4se8n2iCdYfx845XsNCxAAGWjoIeU4ABqA6tGv8A9Pyv34X90a/Mgfp+V+/C/ujX4szDwlri6CHPNufH8RyPYZAfB9nwX5N5fF7wAg/K4gAABwXR/9k=")
       (byte-array (base64:base64-string-to-usb8-array base64-string))
       (output-file-spec "/tmp/image.jpeg")
       (height 618)
       (width 1000)
       (ncomp 3))
  (cl-jpeg:encode-image output-file-spec byte-array ncomp height width))

I also tried creating image online from above base64 string an stored it in local storage. decode the image using cl-jpeg's decode-image function. It gives unsigned-byte 8 array, height ,width, number of components.

I used this data to encode the image using cl-jpeg's encode-image function and it works!

(multiple-value-bind (buff h w ncomp)
    (cl-jpeg:decode-image "<absolute jpeg image path>")
  (cl-jpeg:encode-image "/tmp/image.jpeg" buff ncomp h w))

Now i need to know how to convert base64 string to image?

Any suggetions will help

Thanks.


Solution

  • Your base64 string already represents an encoded sequence of bytes of a JPEG file, you don't need to convert your base64 decoded bytes to JPEG, you just have to directly write the decoded bytes to a binary file like this :

    (ql:quickload :cl-base64)
    
    (defparameter *base64-string*
      "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/xK55XttAMrmqDK4KlXl8XvBWP8nj9wBvJAP9isqKEbyQD/YrKnqd+AvOLpIAJp4I3xdJBugACCFEdIAA6DHRAg0TVNhxSDJxE1TYcUgxBnfhzzi6CGV2k8ZveT7JAO0dU7Qfsh9NyfzDPLR/Rcr3ALolw+MDHKWXRLh8YGOEbW+Jn3J9tkE+xr/FELy/7bYugABio6sGqAAAwMUEbyzzOF2EYSfLPM4XYRhcddwQ9EAQ4+BDhuVeXxe8ZJ2U/qn4n5AFjQhVcHGK4WNCFVwcYitH4se8n2iCdYfx845XsNCxAAGWjoIeU4ABqA6tGv8A9Pyv34X90a/Mgfp+V+/C/ujX4szDwlri6CHPNufH8RyPYZAfB9nwX5N5fF7wAg/K4gAABwXR/9k=")
    
    (with-open-file (out "output.jpeg"
                         :direction :output
                         :if-exists :supersede
                         :element-type '(unsigned-byte 8))
      (write-sequence (cl-base64:base64-string-to-usb8-array *base64-string*) out))