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

Notification

Icon
Error

Options
Go to last post Go to first unread
bma  
#1 Posted : Tuesday, December 20, 2016 2:22:26 AM(UTC)
bma

Rank: Member

Groups: Member
Joined: 1/12/2016(UTC)
Posts: 23

Thanks: 8 times
Hello,

I'm using Graphics Mill to determine the content type of an image. So far we were able to determine the content type of all eps, until now:

Here's a code snippet:

Code:

var file = File.ReadAllBytes(@"D:\tests\Demo-Badges.eps");

using (var stream = new MemoryStream(file))
using (var imageReader = ImageReader.Create(stream))
{

	var contentType = imageReader.FileFormat;

}


Exception: The media format is not supported.

However if we use the EpsReader, the GM thell us that the content type is Eps, because EpsReader can read that file..

Is it possible to have the same behaviour when using ImageReader.Create()?

Kind regards

Demo-Badges.zip (226kb) downloaded 3 time(s).

Edited by user Tuesday, December 20, 2016 2:23:31 AM(UTC)  | Reason: Not specified

Fedor  
#2 Posted : Tuesday, December 20, 2016 9:28:59 PM(UTC)
Fedor

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 40 time(s) in 39 post(s)
Thank you for the problem report. We confirm the bug (#0022899) and will fix it shortly.

BTW, when I open the file in GSView (Ghostscript) I receive a warning (see an attachment).

gsview-warning.png
Best regards,
Fedor Skvortsov
bma  
#3 Posted : Friday, December 23, 2016 1:49:00 AM(UTC)
bma

Rank: Member

Groups: Member
Joined: 1/12/2016(UTC)
Posts: 23

Thanks: 8 times
Thank your for your support.
The image provided was one of the images, that our customers reported, that was working..
Finally, I temporarily fix the problem reading the file signature:

Code:

private static bool IsContentEps(byte[] content)
{
	return
		content != null
		&&
		(
			content.Take(4).SequenceEqual(new byte[] { 0xC5, 0xD0, 0xD3, 0xC6 })
			||
			content.Take(8).SequenceEqual(new byte[] { 0x25, 0x21, 0x50, 0x53, 0x2D, 0x41, 0x64, 0x6F })
		);

}



All my best

Edited by user Friday, December 23, 2016 1:49:56 AM(UTC)  | Reason: Not specified

Fedor  
#4 Posted : Wednesday, February 15, 2017 3:26:05 AM(UTC)
Fedor

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 40 time(s) in 39 post(s)
The problem was solved in the recently released version 9.0.33.
Best regards,
Fedor Skvortsov
Users browsing this topic
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.