Ajouter du texte à une image@lwx228 demandé Comment ajouter du texte à une cellule contenant une image chargée ?Cette idée est assez simple : placez l'image dans une boîte de cadre, utilisez un script graphique pour décorer, prenez une nouvelle photo. Les détails pour obtenir une belle image aller-retour sont un peu plus compliqués. Le cadre doit être dimensionné et mis à l'échelle, l'image doit être positionnée et l'image finale recadrée.
// 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>
Les résultats, ci-dessous, montrent l'image remplissant la boîte de cadre avec les décorations, et trois images ci-dessous. L'image de gauche est l'original, le centre est modifié et la droite est la différence. La différence est principalement noire, pas de changement, ce qui est bien. Le texte dans la différence est flou car l'anticrénelage a apporté des modifications subtiles au bord du texte.
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.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.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.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.Cercles et texte ajoutés au-dessus de l'image des fruits.
Image de Recadrer une image JPG expliquant comment fonctionne la récolte.
Voir plus...
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.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.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.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.Utilisez une zone de cadre graphique pour ajouter du texte et des lignes au-dessus d'une image.
Utilisez une zone de cadre pour ajouter du texte et des lignes à une image.
Re : Ajouter du texte à une imageD'ACCORD
Merci Craig!
gb[framebox(1)]<<ADD image=""></ADD>
Re : Ajouter du texte à une imageOui. C'est un peu plus difficile, explications ci-dessous.
// 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();">Images ajoutées sur une autre image.</SPAN></SPAN></P>
<P>Le script graphique ne peut pas ajouter l'image. Utilisez le < <ADDIMAGE message="" instead.=""><></ADDIMAGE></P><P> </P>
<P>La fonction GraphBox(...) prend trois types d'arguments : paramètres, messages et scripts. La meilleure pratique consiste à placer les paramètres et les messages en premier, et un seul script à la fin. Les paramètres et messages sont séparés par des virgules. Le script utilise des points-virgules pour séparer les instructions.</P>
<P> </P>
<CODE class=" language-jsl">gb = Graph Box(
<<BACKGROUNDCOLOR></BACKGROUNDCOLOR>
<P> </P>
<P>De très nombreux scripts de boîtes graphiques ont été écrits avec des virgules accidentelles plutôt que des points-virgules. Chaque virgule provoque le début d'un nouveau script, séparé du script précédent. L'exécution de plusieurs scripts alors qu'un seul le ferait représente une surcharge supplémentaire pour JMP.</P>
<P> </P>Re : Ajouter du texte à une imageBonjour Craig!
Je me demande si JSL peut superposer une petite image à la position spécifiée de l'image ?
J'ai cherché dans le manuel d'aide et je n'ai pas trouvé la réponse.
C'est tout ce à quoi je peux penser.Merci les experts !
img = Open( "$SAMPLE_IMAGES/tile.jpg", jpg );
{x, y} = img << size;
img << crop( Left( 100 ), Right( x - 251 ), top( 0 ), bottom( y - 0 ) );
{x1, y1} = img << size;
img2 = Open( "$SAMPLE_IMAGES/black rhino footprint.jpg", jpg );
img << copy;//??
img2 << paste(100,25);//??
obj = New Window( "paste", New Image( img2 ) );<BR />
回复: Ajouter du texte à une imageComment peut augmenter la transparence du portrait, par exemple à 50%
Merci Experts !
Re : Ajouter du texte à une imageBonne question. Voir les lignes 12-18
Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie est désormais transparente à 50 %.
// 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
// adjusting transparency. Katie already has a transparent background, alpha=0, and a mostly opaque
// foreground, alpha=1. Katie probably has some antialiasing around the edge of the shape, 0 < alpha < 1.
// rather than set all the alpha for the entire square to .5, multiply the existing alpha by .5.
// this will leave the alpha=0 at 0, and modify the others...
{r,g,b,a} = overlay2<<GETPIXELS></GETPIXELS>
Ce serait une erreur d'utiliser
{r,g,b,a} = overlay2<<GETPIXELS></GETPIXELS>
qui ignorerait les valeurs existantes en bloquant 0,5 là où il était auparavant de 0,0.
The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.Les parties découpées ne sont plus complètement transparentes.
Le [0,0] fait une affectation matricielle plutôt que de changer a en scalaire. Le carré gris clair me dit que les pixels coupés transparents sont probablement blancs, et les mettre devant le gris plus foncé avec 50% provoque un gris plus clair.
回复: Ajouter du texte à une imageMerci Craig! Comment supprimer directement la valeur de l'axe x et de l'axe y de la fenêtre de dessin dans JSL et annuler le texte de l'étiquette de l'axe x et de l'axe y ?

回复:Ajouter du texte à une imagedt = 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!
Re : Ajouter du texte à une imageCouleur d'arrière-plan transparente pour les graphiques
Une façon d'obtenir un arrière-plan transparent consiste à enregistrer un SVG, puis à modifier le SVG pour supprimer le(s) rectangle(s) d'arrière-plan. Vous pouvez le faire avec un éditeur comme Inkscape ou vous pouvez écrire du JSL pour le faire.
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() >> BadFillPattern + "</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.L'arrière-plan de FireFox apparaît à travers la transparence.
Je sais qu'il existe des outils Linux pour convertir le SVG en PNG transparent. Ces outils existent probablement également sur Win.
edit : Beaucoup d'idées non testées https://stackoverflow.com/questions/6589358/convert-svg-to-png-in-python
Re: Ajouter du texte à une imageOui, j'utilise cette commande tout le temps maintenant
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