画像をスケーリングする簡単なタスクを書きましたが、PNG ファイルに問題があるようです。
タスクの内容 [重要な部分] は次のとおりです。
<image srcdir="${imgResizeDir}" destdir="${imgResizeDir}/md" overwrite="yes" >
<scale width="75%" height="75%"/>
<regexpmapper from="^(.*)-hd\.(.*)$$" to="\1-md.\2"/>
</image>
これを実行すると、次のエラーが発生します。
Error: IOException occurs when search for propriate codecs.
Occurs in: com.sun.media.jai.codec.ImageCodec
java.io.IOException: Bad file descriptor
at java.io.RandomAccessFile.seek(Native Method)
at com.sun.media.jai.codec.FileSeekableStream.readPage(FileSeekableStream.java:141)
at com.sun.media.jai.codec.FileSeekableStream.read(FileSeekableStream.java:181)
at com.sun.media.jai.codec.SeekableStream.readFully(SeekableStream.java:327)
at com.sun.media.jai.codec.SeekableStream.readFully(SeekableStream.java:306)
at com.sun.media.jai.codec.ImageCodec.getDecoderNames(ImageCodec.java:274)
at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1679)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:481)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:830)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:899)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:810)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:899)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:810)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:899)
at javax.media.jai.JAI.createNS(JAI.java:1103)
at javax.media.jai.JAI.create(JAI.java:977)
at javax.media.jai.JAI.create(JAI.java:1672)
at org.apache.tools.ant.taskdefs.optional.image.Image.processFile(Image.java:320)
at org.apache.tools.ant.taskdefs.optional.image.Image.processDir(Image.java:253)
at org.apache.tools.ant.taskdefs.optional.image.Image.execute(Image.java:374)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:29)
java.lang.RuntimeException: - Unable to render RenderedOp for this operation.
at org.apache.tools.ant.taskdefs.optional.image.Image.processFile(Image.java:343)
at org.apache.tools.ant.taskdefs.optional.image.Image.processDir(Image.java:253)
at org.apache.tools.ant.taskdefs.optional.image.Image.execute(Image.java:374)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:29)
Caused by: java.lang.RuntimeException: - Unable to render RenderedOp for this operation.
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:838)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:899)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:810)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:899)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:810)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:899)
at javax.media.jai.JAI.createNS(JAI.java:1103)
at javax.media.jai.JAI.create(JAI.java:977)
at javax.media.jai.JAI.create(JAI.java:1672)
at org.apache.tools.ant.taskdefs.optional.image.Image.processFile(Image.java:320)
... 24 more
幅と高さから % 記号を削除すると、適切なサイズの画像になりますが、PNG はねじ込まれています [半透明の黒いレイヤーで覆われているように見えます]。ほとんどの画像は PNG であり、% を使用する必要があります。
MacOS Lion で Apache Ant 1.8.2 を使用してこのタスクを実行しています。Java バージョン: 1.6.0_31
これを機能させるためにアリに追加する必要があるものはありますか?
ありがとう