Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
saravanakumar38  
#1 Posted : Monday, May 15, 2017 11:26:53 AM(UTC)
saravanakumar38

Rank: Newbie

Groups: Member
Joined: 5/10/2017(UTC)
Posts: 4

Hi,

I am trying to investigate Graphics Mill product to use for our project. Mainly we want to load the PSD file and try to perform below action before saving into PNG file. Will we able to achieve following functionality on PSD file?

1. Change the color of psdShape frame at runtime.

2. Remove psdFrame i.e image? i think it can achived by returning null in FrameCallback. please confirm

3. Edit the text and color of the psdTextFrame? i could see color and text properties are protected

4. Replace psdSmartFrame(i.e image) with new image?

5. Replace current psdShape with new psdShape frame?

Will be able to achieve above functionality with Graphics Mill directly or any work around?

I have attached PSD file for reference.

PSD_To_Png_Image_01.png

photooverlay_5_02.zip (1,543kb) downloaded 13 time(s).

Edited by moderator Monday, May 15, 2017 2:15:11 PM(UTC)  | Reason: formatting

Fedor  
#2 Posted : Friday, May 19, 2017 7:10:50 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Yes, you can implement all functionality using Graphics Mill.

Please see a code example:

Code:
using System;
using Aurigma.GraphicsMill;
using Aurigma.GraphicsMill.AdvancedDrawing;
using Aurigma.GraphicsMill.Templates;
using Aurigma.GraphicsMill.Codecs;
using Aurigma.GraphicsMill.Codecs.Psd;
using Aurigma.GraphicsMill.Transforms;

class Program
{
	static void Main(string[] args)
	{
		var psdProcessor = new PsdProcessor();

		//1. Change the color of psdShape frame at runtime.
		psdProcessor.ShapeCallback = (processor, frame) =>
		{
			if (frame.Name == "secondarycolor")
			{
				var shapeData = new ShapeData(frame);

				shapeData.Brush = new SolidBrush(RgbColor.Red);

				return shapeData;
			}

			return new ShapeData(frame);
		};

		psdProcessor.FrameCallback = (processor, frame) =>
		{
			//2. Remove psdFrame i.e image? i think it can achived by returning null in FrameCallback. please confirm
			if (frame.Name == "photo")
			{
				return null;
			}

			//4. Replace psdSmartFrame(i.e image) with new image?
			if (frame.Name == "logo")
			{
				var smartFrame = (PsdSmartFrame)frame;

				return smartFrame.ToGraphicsContainer(ImageReader.Create("../../../logo.png"),
					ResizeMode.ImageFill);
			}

			//5. Replace current psdShape with new psdShape frame?
			if (frame.Name == "Maincolor")
			{
				var container = new GraphicsContainer(600, 480, 72f, 72f);

				using (var graphics = container.GetGraphics())
				{
					var brush = new SolidBrush(RgbColor.SandyBrown);

					graphics.FillRectangle(brush, 0, 350, 640, 130);
				}

				return container;
			}


			return processor.ProcessFrame(frame);
		};

		//3. Edit the text and color of the psdTextFrame? i could see color and text properties are protected
		psdProcessor.TextCallback = (processor, frame, textString) =>
		{
			var text = processor.ProcessText(frame);

			if (frame.Name == "Phone")
			{
				text.String = "(555) 555-1234";
				text.Brush = new SolidBrush(RgbColor.Blue);

			}

			return text;
		};

		psdProcessor.Render("../../../photooverlay_5_02.psd", "../../../result.png");
	}
}

result.png

P.S. BTW, the layer "Maincolor" is rendered incorrectly. We will fix the problem in the future releases (Aurigma Bug #0023327). I will keep you informed of the status.

Best regards,

Fedor Skvortsov

Fedor  
#3 Posted : Friday, June 23, 2017 2:22:58 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
The bug #0023327 was fixed in the version 9.1.20 of Graphics Mill.
Best regards,

Fedor Skvortsov

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.