?
Solved

How to export canvas as png at 300 dpi

Posted on 2008-11-02
2
Medium Priority
?
3,448 Views
Last Modified: 2013-11-11
I'm creating a Card design application in Flex 3 with php on the server side. I'm running into issues with exporting canvas to png at 300 dpi. So far image is only coming out as 72 dpi. Any idea how to make image output 300dpi. Here's how I currently capture the canvas before sending to php to save image:
drawingBoard.clipContent = false;
	Application.application.clipContent = false;
	
         var base64string:String = ImageSnapshot.encodeImageAsBase64( ImageSnapshot.captureImage(drawingBoard,300, new PNGEncoder(),false) );

Open in new window

0
Comment
Question by:skywalker98
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Expert Comment

by:trypt
ID: 22866596
i don't think u can capture the screen with more than 72 dpi unless ur screen's resolution is more than 72 dpi... but i think u can try this work around... multiply the size of the screen capture image by 417%, then u should get the dimension of the image at 300dpi when printed out...
0
 
LVL 19

Accepted Solution

by:
Gary Benade earned 1500 total points
ID: 22902339

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" creationComplete="init()">
<mx:Script>
	<![CDATA[
		private function init():void
		{
			drawArea.graphics.drawCircle(100,100,100);
			var b:BitmapData = new BitmapData(1000,1000,false,0xFFFFFF);
			var m:Matrix = new Matrix();
			m.scale(300.0/72.0);
			b.draw( drawArea, m);
			var bmp:Bitmap = new Bitmap( b, "auto", true); 
			// bmp will now contain a 300dpi version of drawArea
			// save data here
			b.dispose(); // clean up
		}
	]]>
</mx:Script>
	<mx:HBox id="drawArea" x="24" y="22" width="352" height="211">
	</mx:HBox>
</mx:Canvas>

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question