Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mbochynski/canvas2image

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Canvas2image

a tool of saving or converting canvas to images. It allow also to saveAsImage with filename defined by you! No longer meaningless browser default filenames that may scare some people.

Demo

canvas2image

Code

you can just use it like this

Canvas2Image.saveAsImage(canvasObj, width, height, type, filename, background)
Canvas2Image.saveAsPNG(canvasObj, width, height, filename, background)
Canvas2Image.saveAsJPEG(canvasObj, width, height, filename, background)
Canvas2Image.saveAsGIF(canvasObj, width, height, filename, background)
Canvas2Image.saveAsBMP(canvasObj, width, height, filename, background)
	- filename should be a string without extension
	- background should be a boolean value - if the canvas before save should be 
	filled with white backgound or not

Canvas2Image.convertToImage(canvasObj, width, height, type)
Canvas2Image.convertToPNG(canvasObj, widht, height)
Canvas2Image.convertToJPEG(canvasObj, widht, height)
Canvas2Image.convertToGIF(canvasObj, widht, height)
Canvas2Image.convertToBMP(canvasObj, widht, height)

Supported browsers

I have tested this new feature (custom filename) with following browsers:

  • Opera 12.16 1860 NOK
  • Google Chrome 34.0.1847.132 OK
  • Mozilla Firefox 29.0 OK

More (IE) will be tested soon.

  • NOK => everything seems to be working but saved with browser default filename
  • OK => everything seems to be working fine

About

a tool for saving or converting canvas as img

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%