Solved

How to export canvas as png at 300 dpi

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

737 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