On Mar 26, 7:49 pm, (e-mail address removed) wrote:
Please do not make new posts of existing threads,
even if the subject was not the best. Most people
would hardly notice, and the 'subject line' of an
ongoing thread can be changed, in any case.
How can I split a tiff image ..
1)
..in an AppletViewer ..
2)
..and save it in a particular folder
with a different name?
3)
I put those numbers simply because this
problem can be broken down into distinct
parts. It is much easier to 'separate'
the parts and get each working independently,
then figure later how to put them back
together as a single program.
But to get to the parts.
1) Splitting a (multi-part) TIFF image.
I have not directly dealt with TIFF's
(or other image types not supported in
core Java), but as I understand it, this
will require the JAI (Java advance Imaging)
API. It would be best to figure how to
do this from a command line program, that
takes an argument of a single image name
(e.g. 'myhouse.tiff') and splits each part
into a separate file (e.g. 'myhouse.1.png',
'myhouse.2.png'..).
2) In applet viewer? Interesting term..
Do you actually mean in an applet? ..but
that leads us to the fact that any applet
(or applet viewer) that accesses the local
file system ('save to disk') needs to be
'trusted' in order to break out of the security
sandbox that would normally prevent any disk
access. You might sign the code digitally,
and ask the end user to 'trust' it, but code
signing is tricky, and a huge hassle the first
time it is done (though IDE's are making it a
lot easier). I recommend taking a slightly
different approach.. (mentioned in '3)').
3) Use web start instead, and the code does
not need to be digitally signed - instead,
using the services of the JNLP API, we can
offer the user to save files to disk, and
the user can decide at the time, if they
trust us enough to allow the action to
proceed.
Others would have to help you further with
part 1, of which I have little experience
(OK - 'none'). But I have some good examples
for showing how a web start application or
applet can access the local file system for
saving the image.
<
http://www.physci.org/jws/#fs>
HTH
Andrew T.