Wikipedia:WikiProject Chemistry/Structure drawing workgroup/Mysid's script: Difference between revisions

Content deleted Content added
Fix positioning code
Note on bug.
Line 104:
#read the file one pixel row at a time, always starting at the edge value
#detected, going outwards until we hit a completely empty line (pure
#transparent pixels) This seems to work for all BKchem files, but would of
#BUG:This works for most BKchem files, but is broken by text with gaps at the
#course fail for general SVG files.
#edge. Maybe a nice fat gaussian blur will fix this and make an automatic
#border...
for ($y=$maxy; $y<$he; $y++) {
@row = $img->GetPixels(width=>$wi, height=>1, x=>1, y=>$y, map=>'RGBA');
Line 175 ⟶ 177:
#well. There is a group which encompasses all the tags, so put it there.
if (!$firstgroupflag && /<g/) {
$movexs/<g/<g transform= 0.95*\"translate(-$minx,-$miny)\"/;
$movey = 0.95*$miny;
s/<g/<g transform=\"translate(-$movex,-$movey)\"/;
#Only do it once!
$firstgroupflag = 1 ;