How to convert an image in the wix media to base64 Image bytes. I try to use pdf-lib npm package

How to generate ImageBytes of an image in wix-media;

import { PDFDocument } from 'pdf-lib'

**const jpgImageBytes = ...**
**const pngImageBytes = ...**

// Create a new PDFDocument
const pdfDoc = await PDFDocument.create()

// Embed the JPG image bytes and PNG image bytes
const jpgImage = await pdfDoc.embedJpg(jpgImageBytes)
const pngImage = await pdfDoc.embedPng(pngImageBytes)

// Get the width/height of the JPG image scaled down to 25% of its original size
const jpgDims = jpgImage.scale(0.25)

// Get the width/height of the PNG image scaled down to 50% of its original size
const pngDims = pngImage.scale(0.5)

// Add a blank page to the document
const page = pdfDoc.addPage()

// Draw the JPG image in the center of the page
page.drawImage(jpgImage, {
  x: page.getWidth() / 2 - jpgDims.width / 2,
  y: page.getHeight() / 2 - jpgDims.height / 2,
  width: jpgDims.width,
  height: jpgDims.height,
})

// Draw the PNG image near the lower right corner of the JPG image
page.drawImage(pngImage, {
  x: page.getWidth() / 2 - pngDims.width / 2 + 75,
  y: page.getHeight() / 2 - pngDims.height,
  width: pngDims.width,
  height: pngDims.height,
})

const pdfBytes = await pdfDoc.save()

Are you asking how to upload a file in wix-media? If so you can use https://dev.wix.com/docs/velo/api-reference/wix-media-v2/files/generate-file-upload-url to get a URL and then a library like fetch, axios, or needle to upload the file.