Seamless jpeg resize

2007-12-06
2013-05-30
  • Wesley Morgan

    Wesley Morgan - 2007-12-06

    Is it possible to use the transcoding to do automatic jpeg resizing? I tried this, but it didn't work at all:

      <transcoding enabled="yes">
        <mappings>
          <mimetype-profile>
            <transcode mimetype="image/jpeg" using="jpeg-resize"/>
          </mimetype-profile>
        </mappings>
        <profiles>
          <profile name="jpeg-resize" enabled="yes" type="external">
            <mimetype>image/jpeg</mimetype>
            <accept-url>no</accept-url>
            <first-resource>yes</first-resource>
            <agent command="/usr/local/bin/convert -geometry 1920x1080" arguments="%in %out"/>
            <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
          </profile>
        </profiles>
      </transcoding>

    However, I find that some of the options for the transcoding aren't very well documented and I'm not sure how they work. I don't even think the command is being called, as substituting a little shell script that echoes some debug output to a file showed nothing.

     
    • Jin

      Jin - 2007-12-06

      So far transcoding settings are only documented in the readme.lyx file in the doc directory.

      You almost had it right, you just put command and arguments together, try the following:
              <profile name="jpeg" enabled="yes" type="external">
                  <mimetype>image/jpeg</mimetype>
                  <agent command="convert" arguments="-geometry 1920x1080 %in %out"/>
                  <first-resource>yes</first-resource>
                  <hide-original-resource>yes</hide-original-resource>
                  <buffer size="1048576" chunk-size="2072" fill-size="262144"/>
              </profile>

      Usually you would want to pass the resolution values to the renderer, this can be done with the <resolution> tag in the profile: i.e. <resolution>1920x1080</resolution>, howerver there is one problem: convert will scale the image proportionally, that means that the resulting image will not necessarily have the exact specified dimensions. I am not sure how to work around that; but one solution would be to not specify the resolution and hide the original resource (like in the example above)

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks