[Bio] / Sprout / ScenarioSaplingLoader.pm Repository:
ViewVC logotype

Diff of /Sprout/ScenarioSaplingLoader.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9, Wed Jun 9 20:04:54 2010 UTC revision 1.10, Wed Sep 29 18:00:40 2010 UTC
# Line 243  Line 243 
243      # Get an Image::Magick object. This enables us to convert GIFs to PNGs.      # Get an Image::Magick object. This enables us to convert GIFs to PNGs.
244      my $p = Image::Magick->new();      my $p = Image::Magick->new();
245      # Create a temporary file name for the PNGs.      # Create a temporary file name for the PNGs.
246      my $pngFileName = "$FIG_Config::temp/map$$.png";      my $pngTempFileName = "$FIG_Config::temp/map$$.png";
247      # Loop through the maps.      # Loop through the maps.
248      my @maps = $fig->all_maps();      my @maps = $fig->all_maps();
249      for my $map (sort @maps) {      for my $map (sort @maps) {
# Line 253  Line 253 
253          # Compute its title. The properties of the map are read from files          # Compute its title. The properties of the map are read from files
254          # having this title and different extensions.          # having this title and different extensions.
255          my $mapTitle = "$FIG_Config::kegg/pathway/map/$map";          my $mapTitle = "$FIG_Config::kegg/pathway/map/$map";
256          # Now we need the map itself. We use Image::Magick to convert it to a PNG.          # Now we need the map itself. If it's a PNG, we use it unaltered.
257            my $pngFileName;
258            if (-f "$mapTitle.png") {
259                $pngFileName = "$mapTitle.png";
260            } else {
261                # Here we must use Image::Magick to convert from a GIF to a PNG.
262                $pngFileName = $pngTempFileName;
263          $p->Read("$mapTitle.gif");          $p->Read("$mapTitle.gif");
264          $p->Write($pngFileName);          $p->Write($pngFileName);
265          # Read it back in as a GD::Image.          }
266            # Read the PNG file in as a GD::Image.
267          my $diagram = GD::Image->new($pngFileName);          my $diagram = GD::Image->new($pngFileName);
268          # Write the diagram record.          # Write the diagram record.
269          $self->PutE(Diagram => $map, name => $name);          $self->PutE(Diagram => $map, name => $name);

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3