×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    16

    Question SVG to JPEG / PNG

    Hi,

    This is my use case. I want to
    1. Load an SVG Image
    2. Convert the loaded image into QImage()
    using QT / Symbian APIs. How to proceed with the second step ? Any pointers will be very helpful.
    Last edited by ashwinbhatks; 2010-08-27 at 06:41.

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: SVG to JPEG / PNG

    Does Qt support SVG format,,,?

    For the conversion from one form to another you should have algorithm and have knowledge of both the formats.

    Using Image Formats and Image Transformation you can change the format.

  3. #3
    Nokia Developer Champion
    Join Date
    Sep 2007
    Location
    Bhavnagar
    Posts
    928

    Re: SVG to JPEG / PNG

    Quote Originally Posted by rahulvala View Post
    Does Qt support SVG format,,,?

    For the conversion from one form to another you should have algorithm and have knowledge of both the formats.

    Using Image Formats and Image Transformation you can change the format.
    Yes , Qt supports a SVG format. There is a module called QtSvg foe this purpose,

    Use QSvgWidget for displaying the content of the svg file.
    Jajal Mehul

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    16

    Re: SVG to JPEG / PNG

    Quote Originally Posted by rahulvala View Post
    Does Qt support SVG format,,,? you can change the format.
    Yes QT and symbian both support SVG.

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    16

    Re: SVG to JPEG / PNG

    Thanks james. But i wanted to convert svg file to QImage raw data and later perform other operations on it before displaying it on screen.

  6. #6
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: SVG to JPEG / PNG

    Use QSvgRenderer::render() to render to QPainter, which is constructed to paint on QImage.
    http://doc.trolltech.com/4.6/qsvgrenderer.html

  7. #7
    Registered User
    Join Date
    May 2010
    Posts
    16

    Re: SVG to JPEG / PNG

    Thanks divanov. I tried this and it worked. was simple actually.

    QString svgfile (":/penguin.svg");
    QSvgRenderer svg( svgfile );
    QString destination("C:\\penguin.png");
    QImage image( 311,368, QImage::Format_ARGB32);
    QPainter painter(&image);
    svg.render (&painter);
    image.save( destination, "PNG" );

  8. #8
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: SVG to JPEG / PNG

    You can improve your code by using QSvgRenderer::defaultSize().

Similar Threads

  1. how to converting image from jpeg to png?
    By Kairus in forum Symbian C++
    Replies: 4
    Last Post: 2009-10-26, 04:53
  2. jpeg into png
    By maneeshv6 in forum Mobile Java General
    Replies: 1
    Last Post: 2008-01-21, 20:56
  3. Read JPEG instead PNG
    By ammaia2 in forum Mobile Java General
    Replies: 0
    Last Post: 2005-05-19, 18:27
  4. convert png images to jpeg
    By adneimocne in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2004-05-30, 16:16
  5. J2ME using JPEG instead of PNG
    By swagner@multimedia.au.dk in forum Mobile Java General
    Replies: 1
    Last Post: 2003-05-07, 09:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •