Skip to content

Convert image Blob and File to different formats (png, webp and jpeg)

License

Notifications You must be signed in to change notification settings

arjun-g/blob-image-convert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blob Image Convert

Convert image Blob or File object to different formats (png, webp and jpeg)

toPNG (convert blob to PNG)

Convert image blob to PNG blob

toJPEG (convert blob to JPEG)

Convert image blob to JPEG blob

toWebP (convert blob to WebP) - Works only on chrome, falls back to png

Convert image blob to WebP blob

Usage

Either use the callback or as a Promise

blob.ToPNG(function(pngBlob){
    
})

blob.ToPNG(pngBlob = >{
    
})

blob.ToPNG().then(function(pngBlob) {

})

blob.ToPNG().then(pngBlob => {

})

How it works

The source blog image is drawn on a canvas object and then toDataURL method of canvas to convert to different file type.

About

Convert image Blob and File to different formats (png, webp and jpeg)

Resources

License

Stars

Watchers

Forks

Packages

No packages published