Fügen Sie Text zu einem Bild hinzu@lwx228 fragte Wie füge ich Text zu einer Zelle hinzu, in die ein Bild geladen ist?Diese Idee ist ziemlich einfach: Legen Sie das Bild in einen Rahmen, dekorieren Sie es mit einem grafischen Skript und machen Sie ein neues Bild. Die Details, um ein schönes Rundreisebild zu erhalten, sind etwas komplizierter. Die Größe und Skalierung des Rahmens muss angepasst, das Bild positioniert und das endgültige Bild zugeschnitten werden.
// open the original
original = New Image(
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Oroblanco_%28sweetie%29_fruits.jpg/320px-Oroblanco_%28sweetie%29_fruits.jpg"
);
{xSize, ySize} = original << size;
// use a frame to do the drawing, make the original fit the frame exactly
gb = Graph Box(
<<BACKGROUNDCOLOR></BACKGROUNDCOLOR>
Die Ergebnisse unten zeigen das Bild, das den Rahmenkasten mit den Dekorationen füllt, und drei Bilder unten. Das linke Bild ist das Original, das mittlere ist modifiziert und das rechte ist der Unterschied. Der Unterschied ist größtenteils schwarz, keine Veränderung, was gut ist. Der Text im Unterschied ist unscharf, da das Anti-Aliasing geringfügige Änderungen am Textrand vorgenommen hat.
Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Kreise und Text über dem Fruchtbild hinzugefügt.
Bild von Schneiden Sie ein JPG-Bild zu erklärt, wie Crop funktioniert.
查看更多......
Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Verwenden Sie einen Grafikrahmen, um Text und Linien über einem Bild hinzuzufügen.
Verwenden Sie einen Rahmen, um einem Bild Text und Linien hinzuzufügen.
Betreff: Text zu einem Bild hinzufügenJa. Es ist etwas schwieriger, Erklärungen unten.
// open the original
original = New Image(
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Oroblanco_%28sweetie%29_fruits.jpg/320px-Oroblanco_%28sweetie%29_fruits.jpg"
);
{xSize, ySize} = original << size;
overlay1 = new image("https://us.v-cdn.net/6038925/uploads/images/35680iA0171FFF13D53E06/NaturalCat.png");// cat
{xOverlay1Size, yOverlay1Size} = overlay1 << size;
dt = open("$sample_data/big class families.jmp","invisible");
overlay2 = dt:picture[1];// katie
overlay2<<SCALE></SCALE>
<P> </P>
<P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pictures added over another picture." style="width: 971px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Pictures added over another picture." style="width: 971px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Pictures added over another picture." style="width: 971px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Pictures added over another picture." style="width: 971px;"><span class="lia-inline-image-display-wrapper" image-alt="Pictures added over another picture." style="width: 971px;"><img src="https://us.v-cdn.net/6038925/uploads/images/43745i912405FE3CFBC3E8/PicturePlusPicture.png" role="button" title="PicturePlusPicture.png" alt="Pictures added over another picture." /><span class="lia-inline-image-caption" onclick="event.preventDefault();">Pictures added over another picture.</span></span><SPAN class="lia-inline-image-caption" onclick="event.preventDefault();">Pictures added over another picture.</SPAN></SPAN><SPAN class="lia-inline-image-caption" onclick="event.preventDefault();">Pictures added over another picture.</SPAN></SPAN><SPAN class="lia-inline-image-caption" onclick="event.preventDefault();">Pictures added over another picture.</SPAN></SPAN><SPAN class="lia-inline-image-caption" onclick="event.preventDefault();">Bilder über einem anderen Bild hinzugefügt.</SPAN></SPAN></P>
<P>Das Grafikskript kann das Bild nicht hinzufügen. Verwenden Sie das < <ADDIMAGE message="" instead.=""><></ADDIMAGE></P><P> </P>
<P>Die GraphBox(...)-Funktion akzeptiert drei Arten von Argumenten: Parameter, Nachrichten und Skripte. Die beste Vorgehensweise besteht darin, die Parameter und Meldungen an die erste Stelle zu setzen und am Ende ein einzelnes Skript. Die Parameter und Meldungen werden durch Kommas getrennt. Das Skript verwendet Semikolons, um Anweisungen zu trennen.</P>
<P> </P>
<CODE class=" language-jsl">gb = Graph Box(
<<BACKGROUNDCOLOR></BACKGROUNDCOLOR>
<P> </P>
<P>Viele, viele Diagrammbox-Skripte wurden mit zufälligen Kommas statt mit Semikolons geschrieben. Jedes Komma bewirkt, dass ein neues Skript beginnt, getrennt vom vorherigen Skript. Für JMP ist es etwas zusätzlicher Aufwand, mehrere Skripte auszuführen, wenn dies nur eines tun würde.</P>
<P> </P>Funktion: Text zu einem Bild hinzufügendt = Open( "$SAMPLE_DATA/Big Class.jmp" );
p1 = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Group X( :age ), Color( :sex ) ),
Elements( Bar( X, Y, Legend( 5 ), Response Axis( "X" ), Summary Statistic( "Sum" ) ) )
);
img = p1 << getpicture ;
{r,g,b,a} = img<<GETPIXELS></GETPIXELS>How can Remove white background?Thanks Experts!
Betreff: Einem Bild Text hinzufügenTransparente Hintergrundfarbe für Diagramme
Eine Möglichkeit, einen transparenten Hintergrund zu erhalten, besteht darin, eine SVG-Datei zu speichern und diese dann zu bearbeiten, um die Hintergrundrechtecke zu entfernen. Sie können dies mit einem Editor wie Inkscape tun oder JSL dafür schreiben.
dt = Open( "$sample_data/big class.jmp" );
gb = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder", FrameBox,
// I chose fedcba to be unique, used in patmatch below
{Background Color( -Hex To Number( "fedcba" ) )}
)
)
);
gb << savepicture( "$temp/temp.svg", "svg" );
txt = Load Text File( "$temp/temp.svg" );
Write( txt ); // to log, for debugging
/* remove something like this:
<G fill="#FEDCBA">
<RECT stroke="none" x="75.5" y="33.5" width="509" height="420"></RECT>
</G>
*/
rc = Pat Match( txt, "<G fill="\!">" + Pat Arb() >> SchlechtesFüllmuster + "</G>" );
If( !rc,
Throw( "fill pattern not found" )
);
// the BadFillPattern occurs twice, for two different colors. remove cases of
// <RECT stroke="none" x="75.5" y="33.5" width="509" height="420"></RECT>
// (the svg command that puts a rectangle of color behind the graph's data.)
nfound = 0;
While( Pat Match( txt, BadFillPattern, "" ), nfound += 1 );
If( nfound != 2,
Throw( "nfound=" || Char( nfound ) )
);
Save Text File( "$temp/temp.svg", txt );
// I don't know how you'll load this file on windows to prove it is transparent.
Open( "$temp/temp.svg" ); // this *does* load it, but there is nothing behind it to show through.
// you can open in FireFox and fiddle with the background color to observe the transparency
FireFox background shows through the transparency.FireFox background shows through the transparency.Der FireFox-Hintergrund ist durch die Transparenz sichtbar.
Ich weiß, dass es Linux-Tools gibt, um SVG in ein transparentes PNG zu konvertieren. Diese Tools gibt es wahrscheinlich auch unter Windows.
Bearbeiten: Viele ungetestete Ideen https://stackoverflow.com/questions/6589358/convert-svg-to-png-in-python
Betreff: Einem Bild Text hinzufügenJa, ich benutze diesen Befehl jetzt ständig
run program(executable("I:\00\imdisplay\magick.exe"),options({"C:\3\A1.png -fuzz 0% -transparent white C:\3\A2.png"}));
https://stackoverflow.com/questions/12424018/how-to-replace-white-background-color-with-transparent-of-an-image-in-imagemagic