简体   繁体   中英

Converting a JPG image to PNG

I have a bunch of images in JPG format (eg myImage.jpg) that I would like to convert to a PNG format (eg myImage.png). Is there a way to achieve this using R?

yes you can do that to transform png to jpg :

library(png)
 img <- readPNG("test.png")
library("jpeg")
writeJPEG(img, target = "Converted.jpeg", quality = 1)

and to transform jpg to png :

library("jpeg")
img <- readJPEG(system.file("img", "img.jpg", package="jpeg"))
library(png)
writePNG(img)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM