TcpClientActivex capture to picturebox - vb.net

Hello i'm trying to make an automated camera capture using TcpClientActivex control. I'm still a beginner at vb.net. But i don't know how to capture it then set the picturebox image.
I can use TcpClientActivex.GetImage.Save("location") though but i don't wanna save it into file, i want to set it to picturebox using codes without saving the file. I tried researching for it but the results are not what i was looking for...
i tried TcpClientActivex.GetImage.Save(picturebox1.image)
and
TcpClientActivex.GetImage.SaveAdd(picturebox1.image
but didn't work...

Did you try assigning the image to the picture box?
PictureBox1.Image = TcpClientActivex.GetImage()
Please read up on the Assignment Operator. You might also want to find yourself a tutorial or book to get a grasp of the basic concepts of VB.NET and Object-oriented programming.

Related

VBA PPT AddEffects to Pictures Inconsistently Applies Effects

I am getting really frustrated. I have code that works, as in it literally does what it says it will do, however, it doesn't always correctly read my images on the slides as images. I even went so far as naming them all "Picture" and using it as a variable. It actually worked for a second but then 5 pictures in it stopped working again.
This is the code and it DOES work:
With shp.Fill.PictureEffects
Dim eff As PictureEffect
Set eff = .Insert(msoEffectSharpenSoften)
eff.EffectParameters(1).Value = 1
End With
Why will this block of code not work on all of my images? Even when it throws the error it WILL sharpen the image as intended, but then stop??? I do not understand the problem or what a possible fix might be. This is literally the last bit of my work process that I need to solve...
For the record, I have code that will adjust the Height, Width, and center the image perfectly on the slide with no issues whatsoever, code that will put images in a placeholder and then format text... but for some reason THIS block of code won't work...
I have also tried deleting the image, manually reuploading it using the Insert Picture function in the program and it still doesn't work??? Is it possible this has something to do with the fact I am using PowerPoint 2013?
I tested it a different way by changing the picture format, it seemed like it was working but it didn't. Whether I automate it, whether I insert picture, no matter what I do, whether it's in a pre positioned container or not, this line of code refuses to work. Why are my images, in both PNG and JPEG format not being accepted by PowerPoint VBA?

PDFsharp and VB.NET Ximage.FromStream (FromStream is not a member of XImage)

I have been struggling using PDFsharp in VB.NET in order to create some PDF reports that need to be mailed.
I am stuck with the XImage.FromStream. I am getting the not a member of XImage error and I haven't been able to figure out what specific library I should import in order to make it work or what else should I do.
Finally I got it. In VB.net you have to use Image.FromStream in order to work because for some reason that is unknown to me the XImage.FromStream doesn't work.
Here is the example of the solution.
Dim Picture as XImage
Picture = Image.FromStream(stream)
After this you can draw the picture inside a PDF anywhere you want. I hope this can help anyone with my same issue.

Create variants of a document with corresponding labels for AI training

I am looking for an easy solution for the following problem:
I have to create variants of a document and export them as an image. This could be easily done with the MS Word Mail Merge, but I need the pixel positions of every text block in that document. The image as well as the pixel positions are input for an AI training.
At the moment I can think of several approaches:
Throw the MS Word Mail Merge output into an OCR and try to identify the positions of the text blocks by comparing them with the original text source.
Create the document with something like JS, Python or Visual Basic and save the exact positions of each inserted text block at the time of inserting.
Maybe use Visual Basic for Word to extract the text positions from the MS Word XML file that was created with the Mail Merge function.
Variant 1 seems to be overly complicated because it uses some kind of reverse engineering. Additionally, using an OCR even on a perfectly readible document can always be a source of error.
So variants 2 or 3 seem fine, but I don't know any libraries that fit the requirements and Visual Basic for Word is absolutely new territory for me.
I hope I described the problem well enough. If you want me to clarify something, please let me know.
I appreciate every idea and help! :)
Best Regards
Henrik
Seems like someone already dislikes my post. Please let me know how I can improve before voting me down..
Anyway, I may have found a way to realize variant 2. This stackoverflow post references a Github Gist that extends the Python Image Library. It offers a function to write text on an image and also set a maximum width for the text box. The function also returns the final width and height of the drawn text box. Using this I will try to implement an algorithm that creates the document images as well as the label files.
Maybe this will also help someone else looking for the same thing.

Excel VBA - Saving A Series of Charts into one GIF picture for the animation effect

I want to use VBA programming to save a a series of charts in Excel into one GIF picture for the animation effect. Is there any solution?
The below is a related question which address the issue of saving a chart into a GIF file one by one without any animation effect.
Excel VBA - Saving Charts as GIF files
Looks like VBA cannot export animated gifs itself, which makes for an interesting programming challenge. You have two options:
Make the GIF file yourself
The GIF specification doesn't look hard. In fact, here's a guy who says it's easy to implement it in VBA. If you have time and are coding for learning or for fun, I'd attempt this. If you're hard pressed, try the next suggestion.
Call a third-party tool from your code
Have a free tool like Gifsicle do the job for you (download the Windows port). In your code, when it's time to create the resulting GIF, instead of something like
call CreateGif("result.gif", "input1.gif", "input2.gif", "input3.gif")
You will externally call the .exe tool, like:
call Shell("C:\path\to\gifsicle.exe input1.gif input2.gif input3.gif > result.gif")
Note that you'll probably need to fiddle with quoting paths and generally building the command line correctly (you'll use a loop if the number of input GIFs is variable). Read Gifsicle's man page for usage details.

Printscreen the screen and save the image(VB)

Can someone help me, how can I printscreen my screen that can be saved in gif or jpeg format
locally in VB.net
I know this question was asked a long time ago so I post this for posterity.
It's quite trivial to preform a screen capture operation using the CopyFromScreen method in the Graphics class. Also, the BitMap class ships with a Save method; making this even more trivial.
Using image As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
Using surface As Graphics = Graphics.FromImage(image)
surface.CopyFromScreen(Screen.PrimaryScreen.Bounds.Location, Point.Empty, image.Size)
End Using
image.Save("C:\myimage.jpg", Imaging.ImageFormat.Jpeg)
End Using
One possible solution when dealing with multiple monitors is to iterate, capture and save each screen as individual images. Place the above code inside the following For Each Next statement and replace Screen.PrimaryScreen with monitor. Be sure that you set a unique file name for each image.
For Each monitor As Screen In Screen.AllScreens
'...
Next