</li>
</ul>
- <a name="htmlexport" />
<p>
+ <strong>PNG Export Options</strong>
+
+ <p>
+ <em>Since Jalview 2.11.3</em> it is possible to specify options when <a
+ href="../features/clarguments-reference.html#exportingimagefiles">exporting
+ figures via the command line</a> to increase the resolution of the
+ exported PNG, and configure maximum width and height settings.
+
+ <p>You can also configure default export settings by adding the
+ following lines to
+
+ <pre>.jalview_properties</pre>
+ <pre>BITMAP_SCALE=<Scale factor multiplied by 10>
+ BITMAP_WIDTH=Width of export in pixels
+ BITMAP_HEIGHT=Height of figure export in pixels
+ </pre>
+ When scale is not set, the figure will be scaled to fit in the smallest
+ specified dimension. Scale will be ignored if it results in an image
+ dimension greater than the smallest specified dimension.
+ <p>
+ <a name="htmlexport" /><p>
<strong>Exporting alignments as Web Pages</strong>
<p>
In Jalview 2.9, new HTML exporting options were introduced. The
- <!-- JAL-4221 --> sequence descriptions are updated from database reference sources if not already defined
- <!-- JAL-4273 --> Visible adjuster marks to grab and adjust annotation panel height and id width
+- <!-- JAL-4274 --> Command line options and configurable bitmap export preferences for height, width and scale factor
### Improved support for working with computationally determined models
* <li>WRAP_ALIGNMENT</li>
* <li>EPS_RENDERING (Prompt each time|Lineart|Text) default for EPS rendering
* style check</li>
+ * <li>BITMAP_SCALE - scale factor for PNG export - default 0 - native resolution</li>
+ * <li>BITMAP_HEIGHT - height bound for PNG export or 0 for unbound</li>
+ * <li>BITMAP_WIDTH - width bound for PNG export or 0 for unbound</li>
* <li>SORT_ALIGNMENT (No sort|Id|Pairwise Identity)</li>
* <li>SEQUENCE_LINKS list of name|URL pairs for opening a url with
* $SEQUENCE_ID$</li>
private static final Collection<String> bootstrapProperties = new ArrayList<>(
Arrays.asList(JALVIEWLOGLEVEL, BOOTSTRAP_TEST));
+
public static Properties bootstrapProperties(String filename)
{
Properties bootstrapProps = new Properties();
*/
public void createPNG(File f) throws ImageOutputException
{
- createPNG(f, null, BitmapImageSizing.nullBitmapImageSizing());
+ createPNG(f, null, BitmapImageSizing.defaultBitmapImageSizing());
}
public void createPNG(File f, String renderer, BitmapImageSizing userBis)
package jalview.util.imagemaker;
+import jalview.bin.Cache;
+
public class BitmapImageSizing
{
public final float scale;
{
return new BitmapImageSizing(0.0f, 0, 0);
}
+
+ public static final String BITMAP_SCALE = "BITMAP_SCALE";
+
+ public static final String BITMAP_HEIGHT = "BITMAP_HEIGHT";
+
+ public static final String BITMAP_WIDTH = "BITMAP_WIDTH";
+
+ /**
+ *
+ * @return bean configured from Cache keys
+ */
+ public static BitmapImageSizing defaultBitmapImageSizing()
+ {
+
+ return new BitmapImageSizing(Cache.getDefault(BITMAP_SCALE,0)/10f,Cache.getDefault(BITMAP_WIDTH,0),Cache.getDefault(BITMAP_HEIGHT,0));
+
+ }
}
--- /dev/null
+package jalview.util.imagemaker;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import jalview.bin.Cache;
+
+public class BitmapImageSizeTest {
+ @Test(groups = {"Functional"})
+ public void testCacheSettingsRecovery() {
+ Cache.setPropsAreReadOnly(true);
+ Cache.loadProperties("test/jalview/bin/testProps.jvprops");
+
+ Cache.removeProperty(BitmapImageSizing.BITMAP_HEIGHT);
+ Cache.removeProperty(BitmapImageSizing.BITMAP_SCALE);
+ Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
+
+ BitmapImageSizing def = BitmapImageSizing.defaultBitmapImageSizing();
+ BitmapImageSizing zero = BitmapImageSizing.nullBitmapImageSizing();
+
+ assertEquals(def.height, zero.height);
+ assertEquals(def.width, zero.width);
+ assertEquals(def.scale, zero.scale);
+
+ Cache.setProperty(BitmapImageSizing.BITMAP_HEIGHT,"120");
+ Cache.setProperty(BitmapImageSizing.BITMAP_SCALE,"240");
+ Cache.setProperty(BitmapImageSizing.BITMAP_WIDTH,"360");
+
+ def = BitmapImageSizing.defaultBitmapImageSizing();
+
+ assertEquals(def.height, 120);
+ assertEquals(def.width, 360);
+ assertEquals(def.scale, 24f);
+
+ Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
+
+ def = BitmapImageSizing.defaultBitmapImageSizing();
+ assertEquals(def.height, 120);
+ assertEquals(def.width, zero.width);
+ assertEquals(def.scale, 24f);
+ }
+}