Solved

How to export canvas as png at 300 dpi

Posted on 2008-11-02
2
3,363 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
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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FLV versus SWF 11 283
adobe flash plugin has crashed while listening to pandora 2 75
embedding a media live encoder stream 3 149
Adobe Indesign CS6 4 131
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
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 set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

821 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