Skip to content

High quality image using Zoom #842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vizlipuzli opened this issue Apr 7, 2016 · 5 comments
Closed

High quality image using Zoom #842

vizlipuzli opened this issue Apr 7, 2016 · 5 comments

Comments

@vizlipuzli
Copy link

I would like generate high quality image from DOM element. I tried to scale up element using css "zoom" by without success ;( zoom is not implemented?

@enjoytheday
Copy link

https://jsfiddle.net/enjoythedaycsk/9L966sdd/1/

I tried to achieve high resolution thing in this example but didn't get that...

Click on download pngx2 button..

Is it possible to do operations on backend like when button is clicked canvas turns into twice its size and then pic is captured and then again canvas is taken back to regular size..

@luck2011
Copy link

luck2011 commented May 8, 2016

I choose transform scale(2), not bad!
Wish html2canvas add an option(feature) like multiplier(zoom). 😃

@enjoytheday
Copy link

can you please share your code so that we can see what result are you getting exactly

@luck2011
Copy link

luck2011 commented May 10, 2016

@enjoytheday I scaled the dom, so we should make sure the user cannot see this scale. But here we can't set the dom to display:none, otherwise html2canvas will not working! So I set zIndex of the positioned dom to -1, it works!

  myDom.style.transform = myDom.style.webkitTransform = 'scale(2)'
  myDom.style.transformOrigin = myDom.style.webkitTransformOrigin = '0 0'
  html2canvas(myDom, {
    width: myDom.offsetWidth * 2,
    height: myDom.offsetHeight * 2
  }).then(function(canvas) {
    var data = canvas.toDataURL()    // now img quality doubled!
  })

@enjoytheday
Copy link

enjoytheday commented May 16, 2016

@luck2011 can you please set this this in jsfiddle example?

https://jsfiddle.net/enjoythedaycsk/9L966sdd/1/

I tried but its not being set by me.

You can edit it completely or can create new one.

It will be helpful to many 💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants