Hi,
Use the below code after showing the image on the screen. Pass the image
container instance in this method as a parameter and it will return the
ByteArray with DPI u want. In below code, 120 is the DPI set.
*
private* *function* getSnapshotByteArray( target:UIComponent ):ByteArray
{
*var* myImage:ImageSnapshot = ImageSnapshot.captureImage(target, 120,
*new*JPEGEncoder());
*return* myImage.data *as* ByteArray;
}
After getting the byte array you can create the image with the DPI u want by
using the below method. Pass the ByteArray to this method as a parameter and
it will return the image.
*
private* *function* loadMapImage(byte:ByteArray):Image
{
*var* byteArr:ByteArray = byte;
*var* mapImage:Image;
*if*(byteArr)
{
mapImage = *new* Image();
mapImage.load(byteArr);
}
*return* mapImage;
}
Hope this helps.
Regards
Gagan Deep
On 4 May 2011 11:27, S k R p <[email protected]> wrote:
>
>
> Thanks , Gagan ..
>
> Here is my code :
>
>
> var img:Image;
> img.source=processUrlString+"&width="+imagewidth+"&height="+imageheight;
>
> Here processUrlString = "/dashboard/servlet/processmap.do" ( ie i am
> calling java url ..which creates chart and reurns byte[]s to flex. And i
> am
> adding this image to Panel in Flex.
>
> Here .. i want to set Image DPI like 75dpi or 90dpi etc.... by selecting
> the
> dpi from Combobox[Drop down B ox]
> =================
>
> GAGAN anand-2 wrote:
> >
> > Hi,
> >
> > Please could you provide me the code u r using for loading the image of
> > charts. Are u using URLLoader or something else?
> >
> > Thanks
> > Gagan Deep
> > On 3 May 2011 19:15, S k R p <[email protected]> wrote:
> >
> >>
> >> Hi thanks Gagan ,
> >> i am new to flex ...
> >>
> >> Can u please provide how to take image into bytearray and using
> >> JPEGEncoder , how to set the dpi...
> >>
> >>
> >> please help..
> >>
> >>
> >>
> >>
> >> GAGAN anand-2 wrote:
> >> >
> >> > Hi,
> >> >
> >> > If you are getting direct image from java end, then you can take that
> >> > image
> >> > in byte array and then through JPEGEncoder or PNGEncoder you can
> >> provide
> >> > as
> >> > much DPI as you want.
> >> >
> >> > For your reference you can google about JPEGEncoder or PNGEncoder.
> >> >
> >> > Hope this helps
> >> >
> >> > Regards
> >> > Gagan Deep
> >> >
> >> > On 28 April 2011 09:50, Pranav Negandhi <[email protected]> wrote:
> >> >
> >> >> I don't think you can increase the DPI. Assuming you need this for
> >> high
> >> >> quality printouts, you could, however, generate a larger image. DPI
> is
> >> >> just
> >> >> a measure of the number of pixels which are used when taking a
> >> printout.
> >> >> If
> >> >> your image is made up of 720 pixels and is used to generate a print
> 10
> >> >> inches wide, you're left with 72 pixels per inch. Instead, double the
> >> >> image
> >> >> size to 1440 and then take a printout on the same size of paper, you
> >> have
> >> >> 144 pixels per inch.
> >> >>
> >> >> The downside is that the image will take up big gobs of memory. And
> if
> >> >> this
> >> >> is done on the client-side, it could possibly bring the client
> >> computer
> >> >> down
> >> >> on its knees. Make sure to clear memory after you're done. Setting
> the
> >> >> bitmap data to null explicitly causes it to be garbage collected
> >> >> immediately
> >> >> in most cases.
> >> >>
> >> >> .p
> >> >>
> >> >>
> >> >> On Wed, Apr 27, 2011 at 1:56 PM, S k R p <[email protected]>
> >> >> wrote:
> >> >>
> >> >>>
> >> >>> Hi All,
> >> >>>
> >> >>> I am getting the generated image of Charts , processes etc from
> >> >>> Java(JFree Charts) to Flex.
> >> >>> But my requirement is to increase dpi of those charts in flex.
> >> >>>
> >> >>> How to do that ...is there any solution for that??
> >> >>> --
> >> >>> View this message in context:
> >> >>>
> >>
> http://old.nabble.com/Increase-dpi-of-a-image-%28Chart-%2C-process-%29-tp31485455p31485455.html
> >> >>> Sent from the Flex India mailing list archive at Nabble.com.
> >> >>>
> >> >>> --
> >> >>> You received this message because you are subscribed to the Google
> >> >>> Groups
> >> >>> "Flex India Community" group.
> >> >>> To post to this group, send email to [email protected].
> >> >>> To unsubscribe from this group, send email to
> >> >>> [email protected].
> >> >>> For more options, visit this group at
> >> >>> http://groups.google.com/group/flex_india?hl=en.
> >> >>>
> >> >>>
> >> >> --
> >> >> You received this message because you are subscribed to the Google
> >> Groups
> >> >> "Flex India Community" group.
> >> >> To post to this group, send email to [email protected].
> >> >> To unsubscribe from this group, send email to
> >> >> [email protected].
> >> >> For more options, visit this group at
> >> >> http://groups.google.com/group/flex_india?hl=en.
> >> >>
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> Groups
> >> > "Flex India Community" group.
> >> > To post to this group, send email to [email protected].
> >> > To unsubscribe from this group, send email to
> >> > [email protected].
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/flex_india?hl=en.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Increase-dpi-of-a-image-%28Chart-%2C-process-%29-tp31485455p31532566.html
> >> Sent from the Flex India mailing list archive at Nabble.com.
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Flex India Community" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected].
> >> For more options, visit this group at
> >> http://groups.google.com/group/flex_india?hl=en.
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Flex India Community" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> > http://groups.google.com/group/flex_india?hl=en.
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Increase-dpi-of-a-image-%28Chart-%2C-process-%29-tp31485455p31538752.html
> Sent from the Flex India mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.