How to rescale image node? - graphviz

Without using HTML, what is a straightforward way to resize external images used in a GraphViz document?
For example, with the following:
somenode [size=1 image="littleperson.png", label=""];
How can the image be made smaller? [Preferably without HTML, using HTML if it's most straightforward/unavoidable.]
I'm not having much luck with HTML:
somenode [label=<<IMG SRC="littleperson.png" />>];
Throws back an error.

You can make the external images smaller several ways.
Without HTML, Using imagescale attribute and / or fixedsize attribute, along with the width and height attributes of the node.
somenode [width=50 height=50 fixedsize=true image="littleperson.png", label=""];
With HTML (img HTML tag takes the scale attribute which has same parameters as imagescale), attributes for fixedsize and height and width are of the td which contains the image tag.
somenode [label=< <table><tr><td fixedsize="true" width="50" height="50"><img src="littleperson.png" /></td></tr></table> >];
Resize the image in a external program and load it
somenode [image="littleperson_resized.png", label=""];
Further documentation / References
How to display an image in a Node
How to set width and height of image displayed in a Node
Graphviz Shapes Documentation
Graphviz Attribute Documentation

Related

SVG display difference between <img> and <object>

What's the difference between displaying a SVG image in an <img> or <object> tag? I was facing some problems using SVG images in a <img> tag on Android 3.1:
The shape in the upper example is an <img> tag and the lowest example is the exact same image but display in an <object>.
Why is this displayed a different way? And is an <object> cached like an <img>?
What do you guys suggest?
Differences when SVG is used as an image (html <img> SVG <image> or CSS background images)
no scripting
no interactivity
no external dependencies (complete in a single file)
no DOM (i.e. no script access into them from outside)
can be copied into canvas via drawImage
I suspect you're suffering from the no external dependencies rule. You may also want to check that the SVG data has a preserveAspectRatio attribute on the root element and if it does that the value of that attribute is not none.

How to connect circle from one svg file to another svg file on same html page in d3 using any layout

I have two div on html page having id container1 and container2 i have created svg for each div and each svg contain circle, Now i want to connect two circle
Is it possible to connect two circle from two svg file on same page (cx,cy of both circle should genrate automatically)
My code snnipet..
Html
<div id="container1 " style="width:900px;height:800px;border:solid;"></div>
<div id="container2 " style="width:900px;height:100px;border:solid; margin-top: 25px;"></div>
created svg for container1 ,container2 using below code
var svg = d3.select("#"+id).append("svg")
.attr("width", $("#"+id).css("width"))
.attr("height",$("#"+id).css("height"));
and draw circle for each container using force layout
Now I want to connect these two circle using line
How is it possible ???
For your general question "how is it possible?", here is a general approach to get you started:
Super-impose a third, mostly transparent SVG over the whole page using absolute positioning. Draw the line inside this SVG.
Use .getScreenCTM() (get screen cumulative transformation matrix) to calculate the position of each circle on the page.
Use the same function to figure out the transformation from the screen to your overlay SVG, and multiply one screen CTM by the inverse of the other to get the net transformation so you can figure the start and end coordinates of your lines from the coordinates of your circles.
Add a listener to the web page as a whole for any re-layout events, and re-do the calculations above as necessary.
If all of that sounds too confusing, you might want to come up with an alternate web page design that puts all the graphics in one SVG. Or one which allows for a different way to indicate that elements are connected (same colour, or hover over one causes highlight on the other).
P.S. You might be able to use .getTransformToElement() to replace steps 2 and 3, but you'll want to test that out thoroughly. I've never tried using it to find the transformation between elements in different SVGs on the same web page.

SVG isn't always sharp

The SVG logo on this site doesn't look sharp on every zoom level. I read once, that SVG is just sharp on a multiple of its original size. But when I rightclick on the graphic and display it alone (without an img tag around it), it looks sharp on every possible zoom. There is no width or height given to the image.
It appears that Firefox renders the SVG to an image when referenced via an <img> tag. Use an <object> tag
I believe the issue is in Firefox.
Try to set the image width to 100% and height to the actual height of the SVG and this will solve the issue.
For Instance.
img{width:100%;
height:xxpx; /* Where 'xx' is the value of the image height in pixels */
}
Hope this Helps.

Image resizing - without css or js...?

Can anyone tell me how this image is resizing? If you remove the bg from the page with firebug you will have a clear vision of the image.
http://canvas.is/images/logo_solid.png
I notice that when the page is scaled the width and height attributes apply and start to scale the image. I have looked through the page and there is no css indicating a percentage width or height and no js in sight.
How is this working?
Thanks
I would tentatively say this is a browser built-in feature as the url ends with image extension, browser know it's not html page, so it would render it in a different way.
Well, I still do not think there is something magical out there, in a normal html page, if you set a fixed width to an image, browser will resize its height automatically. It's more like this scenario:
<div class="image-wrapper">
<img width="100%" src="..."/>
</div>
image would be resized per its original ratio with the width change of image-wrapper

How to set Tiny MCE editor in Joomla to auto fill width and height?

When I insert an image to the Tiny MCE editor at Joomla! backend, I noticed that the inserted img tag don't have width and height param:
<img border="0" alt="Fruit" src="/szalafa/images/stories/fruit.jpg">
It is very time-consuming to set width and height for every image..
How can I force the editor to autocomplete the image dimensions?
Thanks!
ya its time consuming to set height and width for every image . I am also gone through this. Then i prefer to use css to control height and width.I think it will be good to use css to control this.

Resources