Solved

How to export canvas as png at 300 dpi

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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 how to how to record live broadcast.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now