read-jpeg decodes a JPEG image from the given port and decode-jpeg decodes a JPEG image directly from a memory buffer. inbuf must be the address of the buffer and bufsize should be the size in bytes of the coded JPEG image in that buffer. Both functions return a new Isis image, or Null if there is an error.
write-jpeg encodes the given Isis image into a JPEG image and writes it to the given port. The quality argument is optional and should be an integer between 1 (worst) and 100 (best). encode-jpeg encodes the image directly to a memory buffer. outbuf should be the address of the output buffer and bufsize should be its size in bytes. The size must be large enough to handle the largest possible JPEG output for the given image (height * width * 2 + 4096 should be plenty). The actual size of the encoded JPEG image is returned, or Null if there is an error.
read-gif decodes a GIF image from the given port, and decode-gif decodes a GIF image directly from a memory buffer. Both functions return a list of Isis images, or Null if there is an error. If the GIF is not animated, there will be only one item in this list, otherwise there will be as many images as there are frames in the GIF animation.
(set infile (open-input "banjo.gif")) (set image ((read-gif infile) 0)) # using first and only frame in sequence (close infile) (set outfile (open-output "banjo.jpg")) (write-jpeg outfile image 50) (close outfile) (free-image image)