NikitaA Posted May 9, 2025 Share Posted May 9, 2025 We were using VWs 2021 to utilize SDK and connect to a web application through Vectorscripts. Now, we have moved to version 2025 and one urgent issue is coming up. Can somebody help. We take a snapshot of drawing without text around it and it used to work fine in 2021 version. Now that we have moved to 2025, it is taking a screenshot of the drawing along with the text around. Can somebody please help. I am not sure if commands has changed or what is happening. I am using the following: def ClipWhitespaceFromImage(self, inImageFilename): try: image=Image.open(inImageFilename) image.load() bg = Image.new(image.mode, image.size, image.getpixel((0,0))) diff = ImageChops.difference(image, bg) diff = ImageChops.add(diff, diff, 2.0, -100) bbox = diff.getbbox() if bbox: new_image = image.crop(bbox) new_image.save(inImageFilename) logging.debug("Saved clipped image to " + inImageFilename) except: logging.debug("!!!Exception: In ClipWhitespaceFromImage: " + traceback.format_exc()) return inImageFilename def MakeWhitePixelsNonOpaque(self, inImageFilename): try: start_color = (255, 255, 255, 255) # white new_color = (255, 255, 255, 0) # black img = Image.open(inImageFilename).convert("RGBA") shape_data = numpy.array(img) # Replace start color with new color shape_data[(shape_data == start_color).all(axis = -1)] = new_color # Convert back to image final_image = Image.fromarray(shape_data, mode='RGBA') final_image.save(inImageFilename, "PNG") logging.debug("Saved opacity image to " + inImageFilename) except: logging.debug("!!!Exception: In MakeWhitePixelsNonOpaque: " + traceback.format_exc()) return inImageFilename Quote Link to comment
NikitaA Posted June 7, 2025 Author Share Posted June 7, 2025 Actually I found a solution for this bug on GitHub. Also, Vectorworks 2024 works absolutely fine with minor changes in scripting. We have downgraded to use the older version instead. Thanks. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.