Loading ...
Sorry, an error occurred while loading the content.

Re: [svg-developers] Re: Save SVG as PNG file?

Expand Messages
  • Thomas DeWeese
    ... If you got the binary dist. Then there is a jar file called batik-rasterizer.jar . The following should work assuming you are in the release directory: %
    Message 1 of 16 , Mar 1, 2005
    • 0 Attachment
      wywytse wrote:
      >
      > I have download Batik, but how can it automated render the SVG and
      > save it as a PNG??

      If you got the binary dist. Then there is a jar file
      called 'batik-rasterizer.jar'.

      The following should work assuming you are in the
      release directory:

      % java -jar batik-rasterizer.jar -m image/png samples/anne.svg

      You can use -help to get a list of other options (like
      output directory/file, etc).
    • Aashish Singhvi
      An online utility is also available at http://www.fileformat.info/convert/image/svg2raster.htm which uses Batik to do the conversion without having to type on
      Message 2 of 16 , Mar 1, 2005
      • 0 Attachment
        An online utility is also available at
        http://www.fileformat.info/convert/image/svg2raster.htm
        which uses Batik to do the conversion without having to type on the
        command line.

        I tried with some of my SVG files. It is pretty easy to use.
        However, (I don't know if this problem is specific to this utility or
        within the Batik conversion software itself) if you have viewBox
        attributes that do implicit transforms during viewing, the output may
        not be correct.

        HTH,
        Aashish

        --- In svg-developers@yahoogroups.com, "wywytse" <wywytse@y...> wrote:
        >
        > I have download Batik, but how can it automated render the SVG and
        > save it as a PNG??
        >
        > Thanks...........
        >
        >
        >
        > --- In svg-developers@yahoogroups.com, "tbone58x" <tbellmer@e...>
        > wrote:
        > >
        > > Batik worked - thanks!
        > > --- In svg-developers@yahoogroups.com, Thomas DeWeese
        > > <thomas.deweese@k...> wrote:
        > > > Hi Philippe,
        > > >
        > > > > tbone58x wrote:
        > > >
        > > > >>I am using Windows 2000 and need to save the output of SVG
        > content as
        > > > >>a PNG file. What is the best tool to do something like this?
        > > >
        > > > Philippe Lhoste wrote:
        > > >
        > > > > If that's not in the Faq, it really should be.
        > > > > Please, search the list archive for the message "convert svg
        to
        > > jpeg or
        > > > > bitmap" posted a week ago, the answers should fit you.
        > > > > You can also use a snapshot software like MWSnap to capture
        > the
        > > > > rendering of your favorite viewer, maybe automated by
        something
        > > like AutoIt.
        > > >
        > > > If you want it automated use Batik
        > (http://xml.apache.org/batik) to
        > > > render the SVG and save it as a PNG (or JPEG, or TIFF). It does
        > > > essentially all of Static SVG (and most of dynamic SVG, but no
        > > > SMIL animation). So for essentially anything you want to
        > capture as a
        > > > PNG it does a great job.
      • Jan
        I tried this utility with my svg file and it created a blank jpeg file. Any idea why? ... or ... may ... and ... this? ... svg ... does
        Message 3 of 16 , Mar 1, 2005
        • 0 Attachment
          I tried this utility with my svg file and it created a blank jpeg
          file. Any idea why?


          --- In svg-developers@yahoogroups.com, "Aashish Singhvi"
          <aashishsinghvi@y...> wrote:
          >
          > An online utility is also available at
          > http://www.fileformat.info/convert/image/svg2raster.htm
          > which uses Batik to do the conversion without having to type on the
          > command line.
          >
          > I tried with some of my SVG files. It is pretty easy to use.
          > However, (I don't know if this problem is specific to this utility
          or
          > within the Batik conversion software itself) if you have viewBox
          > attributes that do implicit transforms during viewing, the output
          may
          > not be correct.
          >
          > HTH,
          > Aashish
          >
          > --- In svg-developers@yahoogroups.com, "wywytse" <wywytse@y...>
          wrote:
          > >
          > > I have download Batik, but how can it automated render the SVG
          and
          > > save it as a PNG??
          > >
          > > Thanks...........
          > >
          > >
          > >
          > > --- In svg-developers@yahoogroups.com, "tbone58x" <tbellmer@e...>
          > > wrote:
          > > >
          > > > Batik worked - thanks!
          > > > --- In svg-developers@yahoogroups.com, Thomas DeWeese
          > > > <thomas.deweese@k...> wrote:
          > > > > Hi Philippe,
          > > > >
          > > > > > tbone58x wrote:
          > > > >
          > > > > >>I am using Windows 2000 and need to save the output of SVG
          > > content as
          > > > > >>a PNG file. What is the best tool to do something like
          this?
          > > > >
          > > > > Philippe Lhoste wrote:
          > > > >
          > > > > > If that's not in the Faq, it really should be.
          > > > > > Please, search the list archive for the message "convert
          svg
          > to
          > > > jpeg or
          > > > > > bitmap" posted a week ago, the answers should fit you.
          > > > > > You can also use a snapshot software like MWSnap to capture
          > > the
          > > > > > rendering of your favorite viewer, maybe automated by
          > something
          > > > like AutoIt.
          > > > >
          > > > > If you want it automated use Batik
          > > (http://xml.apache.org/batik) to
          > > > > render the SVG and save it as a PNG (or JPEG, or TIFF). It
          does
          > > > > essentially all of Static SVG (and most of dynamic SVG, but no
          > > > > SMIL animation). So for essentially anything you want to
          > > capture as a
          > > > > PNG it does a great job.
        • Aashish Singhvi
          Can you share the svg file that you were trying to convert to JPEG? I tried converting to PNG, JPEG and it produces something. May be, it is the issue with
          Message 4 of 16 , Mar 1, 2005
          • 0 Attachment
            Can you share the svg file that you were trying to convert to JPEG?
            I tried converting to PNG, JPEG and it produces something.

            May be, it is the issue with viewBox, I mentioned below.

            -Aashish

            --- In svg-developers@yahoogroups.com, "Jan" <janlmiller@c...> wrote:
            >
            > I tried this utility with my svg file and it created a blank jpeg
            > file. Any idea why?
            >
            >
            > --- In svg-developers@yahoogroups.com, "Aashish Singhvi"
            > <aashishsinghvi@y...> wrote:
            > >
            > > An online utility is also available at
            > > http://www.fileformat.info/convert/image/svg2raster.htm
            > > which uses Batik to do the conversion without having to type on
            the
            > > command line.
            > >
            > > I tried with some of my SVG files. It is pretty easy to use.
            > > However, (I don't know if this problem is specific to this
            utility
            > or
            > > within the Batik conversion software itself) if you have viewBox
            > > attributes that do implicit transforms during viewing, the output
            > may
            > > not be correct.
            > >
            > > HTH,
            > > Aashish
            > >
            > > --- In svg-developers@yahoogroups.com, "wywytse" <wywytse@y...>
            > wrote:
            > > >
            > > > I have download Batik, but how can it automated render the SVG
            > and
            > > > save it as a PNG??
            > > >
            > > > Thanks...........
            > > >
            > > >
            > > >
            > > > --- In svg-developers@yahoogroups.com, "tbone58x"
            <tbellmer@e...>
            > > > wrote:
            > > > >
            > > > > Batik worked - thanks!
            > > > > --- In svg-developers@yahoogroups.com, Thomas DeWeese
            > > > > <thomas.deweese@k...> wrote:
            > > > > > Hi Philippe,
            > > > > >
            > > > > > > tbone58x wrote:
            > > > > >
            > > > > > >>I am using Windows 2000 and need to save the output of
            SVG
            > > > content as
            > > > > > >>a PNG file. What is the best tool to do something like
            > this?
            > > > > >
            > > > > > Philippe Lhoste wrote:
            > > > > >
            > > > > > > If that's not in the Faq, it really should be.
            > > > > > > Please, search the list archive for the message "convert
            > svg
            > > to
            > > > > jpeg or
            > > > > > > bitmap" posted a week ago, the answers should fit you.
            > > > > > > You can also use a snapshot software like MWSnap to
            capture
            > > > the
            > > > > > > rendering of your favorite viewer, maybe automated by
            > > something
            > > > > like AutoIt.
            > > > > >
            > > > > > If you want it automated use Batik
            > > > (http://xml.apache.org/batik) to
            > > > > > render the SVG and save it as a PNG (or JPEG, or TIFF). It
            > does
            > > > > > essentially all of Static SVG (and most of dynamic SVG, but
            no
            > > > > > SMIL animation). So for essentially anything you want to
            > > > capture as a
            > > > > > PNG it does a great job.
          • Jan
            I will email to you separately. I tried to upload it to the files area, but even zipped it was too big. If anyone else wants to try it, please let me know.
            Message 5 of 16 , Mar 1, 2005
            • 0 Attachment
              I will email to you separately. I tried to upload it to the files
              area, but even zipped it was too big. If anyone else wants to try
              it, please let me know.

              Thanks,

              Jan

              --- In svg-developers@yahoogroups.com, "Aashish Singhvi"
              <aashishsinghvi@y...> wrote:
              >
              > Can you share the svg file that you were trying to convert to JPEG?
              > I tried converting to PNG, JPEG and it produces something.
              >
              > May be, it is the issue with viewBox, I mentioned below.
              >
              > -Aashish
              >
              > --- In svg-developers@yahoogroups.com, "Jan" <janlmiller@c...>
              wrote:
              > >
              > > I tried this utility with my svg file and it created a blank jpeg
              > > file. Any idea why?
              > >
              > >
              > > --- In svg-developers@yahoogroups.com, "Aashish Singhvi"
              > > <aashishsinghvi@y...> wrote:
              > > >
              > > > An online utility is also available at
              > > > http://www.fileformat.info/convert/image/svg2raster.htm
              > > > which uses Batik to do the conversion without having to type on
              > the
              > > > command line.
              > > >
              > > > I tried with some of my SVG files. It is pretty easy to use.
              > > > However, (I don't know if this problem is specific to this
              > utility
              > > or
              > > > within the Batik conversion software itself) if you have
              viewBox
              > > > attributes that do implicit transforms during viewing, the
              output
              > > may
              > > > not be correct.
              > > >
              > > > HTH,
              > > > Aashish
              > > >
              > > > --- In svg-developers@yahoogroups.com, "wywytse" <wywytse@y...>
              > > wrote:
              > > > >
              > > > > I have download Batik, but how can it automated render the
              SVG
              > > and
              > > > > save it as a PNG??
              > > > >
              > > > > Thanks...........
              > > > >
              > > > >
              > > > >
              > > > > --- In svg-developers@yahoogroups.com, "tbone58x"
              > <tbellmer@e...>
              > > > > wrote:
              > > > > >
              > > > > > Batik worked - thanks!
              > > > > > --- In svg-developers@yahoogroups.com, Thomas DeWeese
              > > > > > <thomas.deweese@k...> wrote:
              > > > > > > Hi Philippe,
              > > > > > >
              > > > > > > > tbone58x wrote:
              > > > > > >
              > > > > > > >>I am using Windows 2000 and need to save the output of
              > SVG
              > > > > content as
              > > > > > > >>a PNG file. What is the best tool to do something like
              > > this?
              > > > > > >
              > > > > > > Philippe Lhoste wrote:
              > > > > > >
              > > > > > > > If that's not in the Faq, it really should be.
              > > > > > > > Please, search the list archive for the
              message "convert
              > > svg
              > > > to
              > > > > > jpeg or
              > > > > > > > bitmap" posted a week ago, the answers should fit you.
              > > > > > > > You can also use a snapshot software like MWSnap to
              > capture
              > > > > the
              > > > > > > > rendering of your favorite viewer, maybe automated by
              > > > something
              > > > > > like AutoIt.
              > > > > > >
              > > > > > > If you want it automated use Batik
              > > > > (http://xml.apache.org/batik) to
              > > > > > > render the SVG and save it as a PNG (or JPEG, or TIFF).
              It
              > > does
              > > > > > > essentially all of Static SVG (and most of dynamic SVG,
              but
              > no
              > > > > > > SMIL animation). So for essentially anything you want to
              > > > > capture as a
              > > > > > > PNG it does a great job.
            • Jan
              I m using the default viewbox, however I am doing a transform= scale (0.00025) within the svg. Jan ... viewBox ... output ... SVG ... message convert ... It
              Message 6 of 16 , Mar 1, 2005
              • 0 Attachment
                I'm using the default viewbox, however I am doing a transform='scale
                (0.00025)' within the svg.

                Jan

                --- In svg-developers@yahoogroups.com, "Aashish Singhvi"
                <aashishsinghvi@y...> wrote:
                >
                > Can you share the svg file that you were trying to convert to JPEG?
                > I tried converting to PNG, JPEG and it produces something.
                >
                > May be, it is the issue with viewBox, I mentioned below.
                >
                > -Aashish
                >
                > --- In svg-developers@yahoogroups.com, "Jan" <janlmiller@c...>
                wrote:
                > >
                > > I tried this utility with my svg file and it created a blank jpeg
                > > file. Any idea why?
                > >
                > >
                > > --- In svg-developers@yahoogroups.com, "Aashish Singhvi"
                > > <aashishsinghvi@y...> wrote:
                > > >
                > > > An online utility is also available at
                > > > http://www.fileformat.info/convert/image/svg2raster.htm
                > > > which uses Batik to do the conversion without having to type on
                > the
                > > > command line.
                > > >
                > > > I tried with some of my SVG files. It is pretty easy to use.
                > > > However, (I don't know if this problem is specific to this
                > utility
                > > or
                > > > within the Batik conversion software itself) if you have
                viewBox
                > > > attributes that do implicit transforms during viewing, the
                output
                > > may
                > > > not be correct.
                > > >
                > > > HTH,
                > > > Aashish
                > > >
                > > > --- In svg-developers@yahoogroups.com, "wywytse" <wywytse@y...>
                > > wrote:
                > > > >
                > > > > I have download Batik, but how can it automated render the
                SVG
                > > and
                > > > > save it as a PNG??
                > > > >
                > > > > Thanks...........
                > > > >
                > > > >
                > > > >
                > > > > --- In svg-developers@yahoogroups.com, "tbone58x"
                > <tbellmer@e...>
                > > > > wrote:
                > > > > >
                > > > > > Batik worked - thanks!
                > > > > > --- In svg-developers@yahoogroups.com, Thomas DeWeese
                > > > > > <thomas.deweese@k...> wrote:
                > > > > > > Hi Philippe,
                > > > > > >
                > > > > > > > tbone58x wrote:
                > > > > > >
                > > > > > > >>I am using Windows 2000 and need to save the output of
                > SVG
                > > > > content as
                > > > > > > >>a PNG file. What is the best tool to do something like
                > > this?
                > > > > > >
                > > > > > > Philippe Lhoste wrote:
                > > > > > >
                > > > > > > > If that's not in the Faq, it really should be.
                > > > > > > > Please, search the list archive for the
                message "convert
                > > svg
                > > > to
                > > > > > jpeg or
                > > > > > > > bitmap" posted a week ago, the answers should fit you.
                > > > > > > > You can also use a snapshot software like MWSnap to
                > capture
                > > > > the
                > > > > > > > rendering of your favorite viewer, maybe automated by
                > > > something
                > > > > > like AutoIt.
                > > > > > >
                > > > > > > If you want it automated use Batik
                > > > > (http://xml.apache.org/batik) to
                > > > > > > render the SVG and save it as a PNG (or JPEG, or TIFF).
                It
                > > does
                > > > > > > essentially all of Static SVG (and most of dynamic SVG,
                but
                > no
                > > > > > > SMIL animation). So for essentially anything you want to
                > > > > capture as a
                > > > > > > PNG it does a great job.
              • Jan
                Do you know if this bug occurs with only the online version of Batik? Maybe I could try to download Batik and try it. Jan ... viewBox ... output ... SVG ...
                Message 7 of 16 , Mar 1, 2005
                • 0 Attachment
                  Do you know if this bug occurs with only the online version of
                  Batik? Maybe I could try to download Batik and try it.

                  Jan

                  --- In svg-developers@yahoogroups.com, "Aashish Singhvi"
                  <aashishsinghvi@y...> wrote:
                  >
                  > Can you share the svg file that you were trying to convert to JPEG?
                  > I tried converting to PNG, JPEG and it produces something.
                  >
                  > May be, it is the issue with viewBox, I mentioned below.
                  >
                  > -Aashish
                  >
                  > --- In svg-developers@yahoogroups.com, "Jan" <janlmiller@c...>
                  wrote:
                  > >
                  > > I tried this utility with my svg file and it created a blank jpeg
                  > > file. Any idea why?
                  > >
                  > >
                  > > --- In svg-developers@yahoogroups.com, "Aashish Singhvi"
                  > > <aashishsinghvi@y...> wrote:
                  > > >
                  > > > An online utility is also available at
                  > > > http://www.fileformat.info/convert/image/svg2raster.htm
                  > > > which uses Batik to do the conversion without having to type on
                  > the
                  > > > command line.
                  > > >
                  > > > I tried with some of my SVG files. It is pretty easy to use.
                  > > > However, (I don't know if this problem is specific to this
                  > utility
                  > > or
                  > > > within the Batik conversion software itself) if you have
                  viewBox
                  > > > attributes that do implicit transforms during viewing, the
                  output
                  > > may
                  > > > not be correct.
                  > > >
                  > > > HTH,
                  > > > Aashish
                  > > >
                  > > > --- In svg-developers@yahoogroups.com, "wywytse" <wywytse@y...>
                  > > wrote:
                  > > > >
                  > > > > I have download Batik, but how can it automated render the
                  SVG
                  > > and
                  > > > > save it as a PNG??
                  > > > >
                  > > > > Thanks...........
                  > > > >
                  > > > >
                  > > > >
                  > > > > --- In svg-developers@yahoogroups.com, "tbone58x"
                  > <tbellmer@e...>
                  > > > > wrote:
                  > > > > >
                  > > > > > Batik worked - thanks!
                  > > > > > --- In svg-developers@yahoogroups.com, Thomas DeWeese
                  > > > > > <thomas.deweese@k...> wrote:
                  > > > > > > Hi Philippe,
                  > > > > > >
                  > > > > > > > tbone58x wrote:
                  > > > > > >
                  > > > > > > >>I am using Windows 2000 and need to save the output of
                  > SVG
                  > > > > content as
                  > > > > > > >>a PNG file. What is the best tool to do something like
                  > > this?
                  > > > > > >
                  > > > > > > Philippe Lhoste wrote:
                  > > > > > >
                  > > > > > > > If that's not in the Faq, it really should be.
                  > > > > > > > Please, search the list archive for the
                  message "convert
                  > > svg
                  > > > to
                  > > > > > jpeg or
                  > > > > > > > bitmap" posted a week ago, the answers should fit you.
                  > > > > > > > You can also use a snapshot software like MWSnap to
                  > capture
                  > > > > the
                  > > > > > > > rendering of your favorite viewer, maybe automated by
                  > > > something
                  > > > > > like AutoIt.
                  > > > > > >
                  > > > > > > If you want it automated use Batik
                  > > > > (http://xml.apache.org/batik) to
                  > > > > > > render the SVG and save it as a PNG (or JPEG, or TIFF).
                  It
                  > > does
                  > > > > > > essentially all of Static SVG (and most of dynamic SVG,
                  but
                  > no
                  > > > > > > SMIL animation). So for essentially anything you want to
                  > > > > capture as a
                  > > > > > > PNG it does a great job.
                • Jan
                  I get the following error when I try to execute the java command line below: C: Program Files Batik SVG Browser batik-1.5.1 java -jar batik- rasterizer.jar -
                  Message 8 of 16 , Mar 1, 2005
                  • 0 Attachment
                    I get the following error when I try to execute the java command line
                    below:

                    C:\Program Files\Batik SVG Browser\batik-1.5.1>java -jar batik-
                    rasterizer.jar -
                    m image/png anne.svg
                    Exception in thread "main" java.security.AccessControlException:
                    access denied (
                    java.util.PropertyPermission java.security.policy write)
                    at java.security.AccessControlContext.checkPermission(Unknown
                    Source)
                    at java.security.AccessController.checkPermission(Unknown
                    Source)
                    at java.lang.SecurityManager.checkPermission(Unknown Source)
                    at java.lang.System.setProperty(Unknown Source)
                    at
                    org.apache.batik.util.ApplicationSecurityEnforcer.installSecurityMana
                    ger(Unknown Source)
                    at
                    org.apache.batik.util.ApplicationSecurityEnforcer.enforceSecurity(Unk
                    nown Source)
                    at org.apache.batik.apps.rasterizer.Main.execute(Unknown
                    Source)
                    at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)


                    Does anyone know why?

                    Jan

                    --- In svg-developers@yahoogroups.com, Thomas DeWeese
                    <thomas.deweese@k...> wrote:
                    > wywytse wrote:
                    > >
                    > > I have download Batik, but how can it automated render the SVG
                    and
                    > > save it as a PNG??
                    >
                    > If you got the binary dist. Then there is a jar file
                    > called 'batik-rasterizer.jar'.
                    >
                    > The following should work assuming you are in the
                    > release directory:
                    >
                    > % java -jar batik-rasterizer.jar -m image/png samples/anne.svg
                    >
                    > You can use -help to get a list of other options (like
                    > output directory/file, etc).
                  • Thomas DeWeese
                    Hi Jan, What version of Java are you using? Is it possible you have a non-standard security policy installed? Anyway you can most likely get around this by
                    Message 9 of 16 , Mar 1, 2005
                    • 0 Attachment
                      Hi Jan,

                      What version of Java are you using?
                      Is it possible you have a non-standard security policy installed?

                      Anyway you can most likely get around this by using the
                      '-scriptSecurityOff' switch (which disables the install of
                      the script security policy).

                      Jan wrote:
                      >
                      > I get the following error when I try to execute the java command line
                      > below:
                      >
                      > C:\Program Files\Batik SVG Browser\batik-1.5.1>java -jar batik-
                      > rasterizer.jar -
                      > m image/png anne.svg
                      > Exception in thread "main" java.security.AccessControlException:
                      > access denied (
                      > java.util.PropertyPermission java.security.policy write)
                    • Thomas DeWeese
                      Hi Aashish, ... Usually the problem is content without a viewBox attribute. The problem is that without a viewBox it is impossible to know what area of the
                      Message 10 of 16 , Mar 1, 2005
                      • 0 Attachment
                        Hi Aashish,

                        Aashish Singhvi wrote:

                        > I tried with some of my SVG files. It is pretty easy to use.
                        > However, (I don't know if this problem is specific to this utility or
                        > within the Batik conversion software itself) if you have viewBox
                        > attributes that do implicit transforms during viewing, the output may
                        > not be correct.

                        Usually the problem is content without a viewBox attribute.
                        The problem is that without a viewBox it is impossible to know what
                        area of the infinate canvas should be displayed. If you have a
                        width and/or height specified it will render 0,0 w, h. If you
                        don't have them either then it randomly chooses 0,0 400,400 as
                        you have provided no useful indication of the region to render
                        (people often suggest using the BBOX and in some cases this
                        may be better, but often the bbox is not correct).

                        This of course is all easily changed if you want to write
                        a little code.
                      • Jan
                        ... Yes, I tried this and that worked. Thanks. ... I m also using width= 100% height= 100% . Guess I ll have to add a viewbox to my svg then and try again.
                        Message 11 of 16 , Mar 2, 2005
                        • 0 Attachment
                          --- In svg-developers@yahoogroups.com, Thomas DeWeese
                          <thomas.deweese@k...> wrote:
                          >Anyway you can most likely get around this by using the
                          >'-scriptSecurityOff' switch (which disables the install of
                          >the script security policy).
                          >
                          Yes, I tried this and that worked. Thanks.

                          > Usually the problem is content without a viewBox attribute.
                          > The problem is that without a viewBox it is impossible to know what
                          > area of the infinate canvas should be displayed. If you have a
                          > width and/or height specified it will render 0,0 w, h. If you
                          > don't have them either then it randomly chooses 0,0 400,400 as
                          > you have provided no useful indication of the region to render
                          > (people often suggest using the BBOX and in some cases this
                          > may be better, but often the bbox is not correct).
                          >
                          > This of course is all easily changed if you want to write
                          > a little code.

                          I'm also using width='100%' height='100%'. Guess I'll have to add a
                          viewbox to my svg then and try again. Thanks.
                        Your message has been successfully submitted and would be delivered to recipients shortly.