biz-Streamマニュアル XMLページレイアウトタグ リファレンス 第4章 イメージ 4.2 イメージ<Image>

4.2 イメージ<Image>


4.2.1機能説明

イメージの定義を行います。Imageタグのcontent(#PCDATA)には使用するイメージファイル名を指定します。



4.2.2属性説明

属性名指定説明指定内容初期値
Name任意名前CDATA
Width任意イメージの幅CDATA実サイズ
Height任意イメージの高さCDATA実サイズ
X任意X座標CDATA0
Y任意Y座標CDATA0
Unit任意単位(Choice)mm / cm / in / px / ptmm
Format任意色空間(Choice)rgb / cmyk ※3 cmyk
Depth任意色階調(Choice)1 / 2 / 4 / 8
GrayScale任意グレースケール(Choice)true / false ※2false
Rate任意拡大縮小率CDATA※10
  • (注)初期値:出荷時のXMLデフォルト情報(default_values.properties)値を表します。ユーザにより値の変更が行われた場合は内容が異なります。
  • ※1Rate:サイズが明示的にレイアウト定義中に定義されている場合、Rateの指定値は無視され、前者のサイズが使用されます。
    また、biz-Streamでは、1インチ=72ピクセル=72ポイントで処理しています。
    72dpi以外の解像度で作成された画像を使用するには、画像の解像度を72dpiに変更していただくか、レイアウトでRateまたはサイズを指定してください。
  • ※2グレースケールをtrueにした場合に使用されるアルゴリズムはpdf.propertiesのgrayscale.algorithmの項目にてNTSC加重平均法またはRGB平均法を選択できます。
  • ※3Format属性の設定を切り替えることによって内部処理で使用するJavaAPIの種類を切り替えることができます。Format属性に「rgb」を指定した場合はAWTのAPIを使用し、「cmyk」を指定した場合はACIのAPIを使用します。

パッケージにより対応できるファイルタイプは下表のようになります。


ファイルタイプカラーパレット圧縮Format属性
rgb(AWT)cmyk(ACI)
GIF
透過GIF×
JPEG※1グレースケールベースライン
プログレッシブ×
RGBベースライン
プログレッシブ×
CMYK(CMYKカラー)ベースライン×
プログレッシブ××
CMYK(YCCKカラー)ベースライン×
プログレッシブ××
BMP※2×
PNGRGB(非透過)
ARGB(透過)×
TIFFモノクローム非圧縮/LZW/PackBit×
JPEG××
Group 3 Fax/Group 4 Fax ※3×
グレースケール非圧縮/LZW/PackBit/JPEG××
RGB非圧縮/LZW/PackBit/JPEG×
  • ※1ロスレス圧縮は非対応。
  • ※2非圧縮、または、8bitRLE圧縮。OS/2フォーマットは非対応。
  • ※3CCITTは非対応。


4.2.3記述例

Imageサンプル1

Imageサンプル1(『<biz-Stream_home>/sample/xml/Image/ImageSample1.xml』)


<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="ImageSample1" Width="50" Height="50" X="10" Y="10" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <!-- 外枠(青線) -->

    <Square Width="30" Height="30" LineColor="14,0,176" FillColor="204,204,204" LineStyle="Solid"/>

    <!-- イメージ -->

    <Image Width="9.7" Height="8.527" X="10" Y="10" Format="rgb">${base-dir}/sample/xml/Image/sample1.jpg</Image>
</Layout>

生成されるPDF(『<biz-Stream_home>/sample/xml/Image/ImageSample1.pdf』)


サンプル1

Imageサンプル2

色階調(Depth属性)に関するサンプルです。
色階調:1ピクセルのデータに何ビット使用するかをを表します。
指定された色階調は、チャネル(例:RGB指定の場合、Red・Green・Blueそれぞれがチャネルとなります)ごとに適用されます。

  1. 「1」指定:1ピクセルに1ビット使用し、2階調を表現します
  2. 「2」指定:1ピクセルに2ビット使用し、4階調を表現します
  3. 「4」指定:1ピクセルに4ビット使用し、16階調を表現します
  4. 「8」指定:1ピクセルに8ビット使用し、256階調を表現します

Imageサンプル2(『<biz-Stream_home>/sample/xml/Image/ImageSample2.xml』)



<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="ImageSample2" Width="105" Height="300" X="10" Y="10" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <!-- イメージ(256階調) -->

    <Image Name="image256" Width="80" Height="60" Y="210" Format="cmyk" Depth="8">${base-dir}/sample/xml/Image/sample2.jpg</Image>
    <!-- イメージ(16階調) -->

    <Image Name="image16" Width="80" Height="60" Y="140" Format="cmyk" Depth="4">${base-dir}/sample/xml/Image/sample2.jpg</Image>
    <!-- イメージ(4階調) -->

    <Image Name="image4" Width="80" Height="60" Y="70" Format="cmyk" Depth="2">${base-dir}/sample/xml/Image/sample2.jpg</Image>
    <!-- イメージ(2階調) -->

    <Image Name="image2" Width="80" Height="60" Y="0" Format="cmyk" Depth="1">${base-dir}/sample/xml/Image/sample2.jpg</Image>
</Layout>
サンプル2

<sample2.jpg内容> 階調操作をしないイメージ

生成されるPDF(『<biz-Stream_home>/sample/xml/Image/ImageSample2.pdf』)



サンプル3
  • 256階調イメージ
  • Red・Green・Blueの各グラフで256階層を表現します。
サンプル4
  • 16階調イメージ
  • Red・Green・Blueの各グラフで16階層を表現します。
サンプル5
  • 4階調イメージ
  • Red・Green・Blueの各グラフで4階層を表現します。
サンプル6
  • 2階調イメージ
  • Red・Green・Blueの各グラフで2階層を表現します。

Imageサンプル3

グレースケール(GrayScale属性)に関するサンプルです。

Imageサンプル3(『<biz-Stream_home>/sample/xml/Image/ImageSample3.xml』)


<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="ImageSample3" Width="105" Height="300" X="10" Y="10" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <!-- イメージ(256階調グレースケール) -->

    <Image Name="image256" Width="80" Height="60" Y="210" Format="cmyk" Depth="8" GrayScale="true">${base-dir}/sample/xml/Image/sample3.jpg</Image>
    <!-- イメージ(16階調グレースケール) -->

    <Image Name="image16" Width="80" Height="60" Y="140" Format="cmyk" Depth="4" GrayScale="true">${base-dir}/sample/xml/Image/sample3.jpg</Image>
    <!-- イメージ(4階調グレースケール) -->

    <Image Name="image4" Width="80" Height="60" Y="70" Format="cmyk" Depth="2" GrayScale="true">${base-dir}/sample/xml/Image/sample3.jpg</Image>
    <!-- イメージ(2階調グレースケール) -->

    <Image Name="image2" Width="80" Height="60" Y="0" Format="cmyk" Depth="1" GrayScale="true">${base-dir}/sample/xml/Image/sample3.jpg</Image>
</Layout>
サンプル7

<sample3.jpg内容> 階調操作をしないイメージ

生成されるPDF(『<biz-Stream_home>/sample/xml/Image/ImageSample3.pdf』)



サンプル8
  • 256階調グレースケールイメージ
  • イメージをグレースケールへ変換し、256階調で表現します。
サンプル9
  • 16階調グレースケールイメージ
  • イメージをグレースケールへ変換し、16階調で表現します。
サンプル10
  • 4階調グレースケールイメージ
  • イメージをグレースケールへ変換し、4階調で表現します。
サンプル11
  • 2階調グレースケールイメージ
  • イメージをグレースケールへ変換し、2階調で表現します。

Imageサンプル4

拡大縮小率(Rate属性)に関するサンプルです。

Imageサンプル4(『<biz-Stream_home>/sample/xml/Image/ImageSample4.xml』)


<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Width="310" Height="150" X="10" Y="10" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <Square Width="281.5" Height="100" Y="5" LineColor="14,0,176" LineStyle="Solid"/>

    <!-- イメージ1 -->

    <Image Width="103mm" Height="91.369mm" X="10" Y="10" Format="cmyk">${base-dir}/sample/xml/Image/sample1.jpg</Image>
    <!-- イメージ2 -->

    <Image Width="" Height="" X="120" Y="10" Format="cmyk">${base-dir}/sample/xml/Image/sample1.jpg</Image>
    <!-- イメージ3 -->

    <Image Width="" Height="" X="220" Y="10" Format="cmyk" Rate="50">${base-dir}/sample/xml/Image/sample1.jpg</Image>
</Layout>


生成されるPDF(『<biz-Stream_home>/sample/xml/Image/ImageSample4.pdf』)



サンプル12
  • イメージ1:実サイズを幅(Width属性)と高さ(Height属性)で指定したケース
  • イメージ2:サイズを指定しないケース(⇒実サイズが適用されます)
  • イメージ3:サイズを指定せず、拡大縮小率(Rate属性)に50%を指定したケース