Welcome to the BEAM Forum!

We encourage you to sign in our forum and participate in the BEAM community. The forum is maintained by the BEAM project team who will most likely answer your questions within 24 hours (except during common holidays) - if not done by other community members. Collaborate, share your knowledge and learn from other users!

If you don't find what you are looking for, please also consider the following external forums:

Combination View Flat View Tree View
Threads [ Previous | Next ]
color legend
toggle
color legend
7/21/09 5:48 PM
Hello,
As I'm new with beam/visat, I have another question. It's about the color legend in visat. Is it possible to add the color legend in the image that I process? I need to have the color legend and the image in the same screen. By this way, if I take 'export view as image', I have the image with her color legend.
Thank you for your help
Flag Flag
RE: color legend
7/22/09 11:17 AM as a reply to Aurelie Lenoir.
You can export an image of the view and an image of the color legend separately.
You can combine them afterwards in any image editor.

Hope that helps,
Marco
Flag Flag
RE: color legend
7/22/09 11:43 AM as a reply to Marco Zühlke.
I take it from your reply that its not possible to create a colour legend at the same time as the image itself, and embed it in the image? If not possible interactively using the gui, is it possible through some sort of scripting?

regards

Will
Flag Flag
RE: color legend
7/22/09 6:38 PM as a reply to Will Aicken.
I include a simple example that combines a band image with an image legend.

 1public class ImageWithLegend {
 2
 3    public static void main(String[] args) throws IOException {
 4        File productFile = new File(args[0]);
 5        Product product = ProductIO.readProduct(productFile, null);
 6        Band band = product.getBands()[0];
 7       
 8        ImageInfo imageInfo = band.getImageInfo(ProgressMonitor.NULL);
 9        RenderedImage bandImg = ImageManager.getInstance().createColoredBandImage(new Band[] {band}, imageInfo, 0);
10       
11        ImageLegend imageLegend = new ImageLegend(imageInfo, band);
12        BufferedImage legendImage = imageLegend.createImage();
13       
14        BufferedImage bufImage = new BufferedImage(bandImg.getWidth(), bandImg.getHeight()+legendImage.getHeight(), BufferedImage.TYPE_INT_RGemoticon;
15        Graphics2D graphics2d = bufImage.createGraphics();
16        graphics2d.drawRenderedImage(bandImg, new AffineTransform());
17        graphics2d.drawImage(legendImage, 0, bandImg.getHeight(), null);
18        graphics2d.dispose();
19       
20        File outputFile = new File(args[1]);
21        FileOutputStream stream = new FileOutputStream(outputFile);
22        ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG", stream, null);
23        encoder.encode(bufImage);
24    }
25}
Flag Flag