I need to crop an image on a Powerpoint slide using VBA - in my particular case I'm cropping from the top and left edges.
Can anyone offer any advice?
The following commands will crop 10 points off of each edge of the shape:
With ActivePresentation.Slides(1).Shapes(1)
.PictureFormat.CropLeft = 10
.PictureFormat.CropTop = 10
.PictureFormat.CropRight = 10
.PictureFormat.CropBottom = 10
End With
Note that this will crop shape number 1 on slide 1. If you want to crop the currently selected shape, use the following as the first line instead:
With ActiveWindow.Selection.ShapeRange(1)
See additional information on the CropBottom/etc. properties here:
https://learn.microsoft.com/en-us/office/vba/api/powerpoint.pictureformat.cropbottom
Related
I trained Mask-RCNN model by Detectron 2 for only one class for instance segmentation of lines. If the line is located at an angle to the horizon close to 0 or 90 degrees and its bounding box does not intersect the boxes of other lines, then segmentation is performed correctly (left figure). On the central and right figures, the boxes of short lines at the corners do not intersect other boxes or intersect slightly and are also segmented correctly. But the masks for long lines are wrong. Are there any ways to fix this error? see figures
I trained 25000 iterations, loss_mask = 0.08, loss_box_reg = 0.19
I think you should rotate an image untill the lines are at 0 or 90 degrees
Try to get the code to set placement and font size of caption/legend of line plot image by DM scripting, as show in the attached pics, can not find them in the help files, only get LinePlotImageDisplayIsLegendShown, any suggestions? thx
Multiple questions, so one at a time
The legend section of a lineplot can not be altered. It can only be shown or hidden. It's size and position is always automatically determined by the application.
The caption font and text size can not be altered by script with the current version of GMS. You may want to file a feature-request for such a script command here: Gatan issue/bug submission form.
The placement coordinates of the window in your screen-shot represents just the coordinates and size of the image window on the workspace and not any of the lineplot content. So you would set it like:
image plot := RealImage("Plot",4,500)
plot = sin( icol/iwidth*5*pi() )
plot.ShowImage()
ImageDocument doc = plot.ImageGetOrCreateImageDocument()
DocumentWindow win = doc.ImageDocumentGetWindow()
number posX = 100
number posY = 50
win.WindowSetFramePosition( posX, posY )
number w = 1200
number h = 200
win.WindowSetFrameSize( w, h )
More commands on window placement are found here:
I am trying to copy pic2 to pic1's bottom right corner (Adding a logo to a picture) Im pretty sure this is the part of the code that im having difficulty with as I cannot figure out whats next after the two getPixel statements.
for x in range(0, getWidth(pic2)):
for y in range(0, getHeight(pic2)):
p1 = getPixel(pic1, x, y)
p2 = getPixel(pic2, x, y)
setPixel = p1
Assuming one image is bigger than the other, you don't need to collect pixels from both picture objects, just the logo.
Seems like this might be homework so I'll just help you along.
for x in range(0, getWidth(pic2)):
for y in range(0, getHeight(pic2)):
p1 = getPixel(pic2, x, y)
p1Col = getColor(p1)
Also, your nested for loops will start in the top left of the image, to apply the logo in the bottom right we use some simple math after getting the logo pixel color.
imageWidth - logoWidth + x - 1
Where the -1 is to prevent the logo exceeding the image width.
Use that same style of formula for the height.
How can I change the shape selection on another slide programmatically?
For example:
My current selection is on the shape 5 (the shape with id = 5) of the slide 3. How can I switch the selection on the shape 6 (the shape with id = 6) of the slide 2 programmatically?
Note: I am writing code in C#, VS Ultimate 2013, PowerPoint 2013
I need to change the point style of a chart in EXCEL 2010.
I have 10000 points, all are represented by diamonds that are overlaped each other in the chart.
It is very hard to see them clearly.
How to change them to a small point not diamonds ?
In EXCEL, available shapes are only diamonds.
Any help would be appreciated.
This will change the marker style of the first series of the active chart:
ActiveChart.SeriesCollection(1).Select
With Selection
.MarkerStyle = 1
.MarkerSize = 5
End With
MarkerStyle 1 sets the series markers to circles and MarkerSize sets their size. Not sure if you have many series or all points on the same series. You will maybe have to loop over the series collection to change the style on all the series.