Giter VIP home page Giter VIP logo

fjcore's People

Watchers

 avatar

fjcore's Issues

Resize *not* to scale?

Probably not a high priority request, but I just easily changed FjCore (all
credit to a well-written library) to allow me to resize a photo to specific
dimensions (stretch/squeeze) rather than to the same scale.  We'd like our
users to upload at 3x4 ratio, but it doesn't always happen and if not, we
squash their photo rather than crop it.  

I renamed Resize to ResizeToScale which is not backwards compatible, but
you could probably just add a ResizeToDimensions or something to Resizer. 

The quality is very good, from what I can tell.  Your library has been great!

Original issue reported on code.google.com by brian%[email protected] on 12 Aug 2009 at 8:38

Memory usage

What steps will reproduce the problem?
1. Run the fjexample silverlight sample code.
2. Open task manager and watch iexplore.exe process.
3. Upload a large file.

What is the expected output? What do you see instead?
Memory usage leaps when decoding the jpeg but should drop after resizing.  
Unfotunately memory usage remains high.

What version of the product are you using? On what operating system?
Using latest source code running on Vista Business, IE 7.0.  Running the 
fjexample silverlight project.

Please provide any additional information below.
When running the http://fluxcapacity.net/fluxtools/emailphotos/ demo, 
memory usage DOES drop - is there some cleanup code that we need to 
implement, or should we use fjcore in a different way to that in 
fjexample? Our testing has led us to believe that calling "new JpegDecoder
(fileStream).Decode()" is the problem.

Original issue reported on code.google.com by [email protected] on 18 Dec 2008 at 12:20

Hierarchical JPEG Support

How hard would it be to add hierarchical JPEG support?
Is hierarchical Jpeg part of the "baseline" spec?

Happy to help if possible.

Original issue reported on code.google.com by [email protected] on 3 Mar 2009 at 7:42

Can Open large files (ex: 1.5MB)

What steps will reproduce the problem?
1. Open a file of 1.5 MB
2. It fails
3.

What is the expected output? What do you see instead?
Index was outside the bounds of the array.

What version of the product are you using? On what operating system?
Windows 

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 4 Aug 2011 at 10:42

FromBitmap, FromFile and FromStream methods for FluxJpeg.Core.Image

I haven't found means to contact the project owners directly, so I'm attaching 
a patched Image.cs to this issue with added methods for those who are wondering 
how to use JpegEncoder with Bitmaps generated by means of .NET code, and for 
those who wish to load raster data from GDI+ supported image formats:

        public static Image FromStream(Stream inStream)
        {
            using (Bitmap bmp = new Bitmap(Bitmap.FromStream(inStream)))
            {
                return FromBitmap(bmp);
            }
        }

        public static Image FromFile(string filePath)
        {
            using (Bitmap bmp = new Bitmap(Bitmap.FromFile(filePath)))
            {
                return FromBitmap(bmp);
            }
        }

        public static Image FromBitmap(Bitmap bitmap)
        {
            int width = bitmap.Width;
            int height = bitmap.Height;
            int bands = 3;
            byte[][,] raster = new byte[bands][,];

            for (int i = 0; i < bands; i++)
            {
                raster[i] = new byte[width, height];
            }

            BitmapData bd = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

            int[] pixels = new int[bd.Width * bd.Height];
            Marshal.Copy(bd.Scan0, pixels, 0, pixels.Length);

            bitmap.UnlockBits(bd);

            for (int row = 0; row < height; row++)
            {
                for (int column = 0; column < width; column++)
                {
                    int pixel = pixels[width * row + column];
                    raster[0][column, row] = (byte)(pixel >> 16);
                    raster[1][column, row] = (byte)(pixel >> 8);
                    raster[2][column, row] = (byte)pixel;
                }
            }

            ColorModel model = new ColorModel { colorspace = ColorSpace.RGB };

            return new Image(model, raster);
        }

Best wishes,
Ilya Melamed

Original issue reported on code.google.com by [email protected] on 1 Mar 2015 at 3:18

Attachments:

Decoder bug: black and grabled/dotted images

What steps will reproduce the problem?
1. new FluxJpeg.Core.Decoder.JpegDecoder(fileStream).Decode()
2. Save file

What is the expected output? What do you see instead?
I expect an image that looks like the input. Instead it is black and 
grabled/dotted; see attached file: output.jpg

What version of the product are you using? On what operating system?
Current, on Vista

Please provide any additional information below.
Decoding the image with .NET lib give expected/correct result:
System.Drawing.Bitmap.FromStream(fileStream))

Use the attached 321.jpg image as input.

Original issue reported on code.google.com by [email protected] on 23 Jun 2009 at 12:27

Attachments:

Encoding a 8-bit Grayscale jpg fails (colorspace conversion bug) | Resubmit

What steps will reproduce the problem?
1. Try to encode a 8-bit Grayscale jpg

What is the expected output? What do you see instead?
Expected: Encoded image.
Actual: IndexOutOfException on Encoding (Line 261, "CompressTo"-method).

What version of the product are you using? On what operating system?
Original version (v1.0?) on. Vista Business SP1

Please provide any additional information below.
This is a Resubmit with more info. I first reported it as a comment on 
issue 1:

---
Comment 1 by snakeware95, Feb 03, 2009
Also there is a bug in the JpegEncoder constructor converting (8-bit) 
Grayscale images.

Replace:
_input.Image.ChangeColorSpace(ColorSpace.YCbCr);

With this to fix:
_input = new DecodedJpeg(_input.Image.ChangeColorSpace(ColorSpace.YCbCr), 
_input.MetaHeaders);

---
Comment 3 by jeff.powers, Feb 19, 2009
snakeware95: the colorspace change happens in-place so I
think that edit isn't needed.  resubmit a bug if problems remain.

---
The colorspace change itself is not the problem, but the properties of the 
surrounding DecodedJpeg (BlockWidth array f.e.) are not updated (still 1 
component). So when you loop over them using the Image.ComponentCount 
(which is 3 after the conversion) in "CompressTo", you get an 
IndexOutOfException on Encoding (Line 261, "CompressTo"-method).

Please try it yourself!

Original issue reported on code.google.com by [email protected] on 3 Mar 2009 at 12:48

CMYK Support

4 color component mode is part of "baseline" specification. It would be
great to have it supported.


Original issue reported on code.google.com by [email protected] on 3 Mar 2009 at 7:44

ProgressChanged event never fires on ImageResizer?

What steps will reproduce the problem?
1. instantiate an ImageResizer
2. attach a handler to the resizer's ProgressChanged event
3. Resize an image

What is the expected output? What do you see instead?
Expected progress updates via the event, but it was never thrown.


Please provide any additional information below.
Looking at the ImageResizer source, it seems like the ResizeProgressChanged
handler event is never attached/thrown, so it would never report progress.
Is this something that may come in future versions?

Original issue reported on code.google.com by brian%[email protected] on 10 Aug 2009 at 9:28

DivideByZeroException when passing in 0 quality

What steps will reproduce the problem?
1. Using the .NET ImageTools library which uses fjcore
            WriteableBitmap bitmap = new WriteableBitmap(pictureElement, 
null);
            ImageTools.Image image = bitmap.ToImage();
            MemoryStream stream = new MemoryStream();
            JpegEncoder encoder = new JpegEncoder();
            encoder.Encode(image, stream); 


What is the expected output? What do you see instead?

EXPECTED: Image is encoded

ACTUAL: 
Attempted to divide by zero.

   at FluxJpeg.Core.DCT.Initialize(Int32 quality)
   at FluxJpeg.Core.DCT..ctor(Int32 quality)
   at FluxJpeg.Core.Encoder.JpegEncoder..ctor(DecodedJpeg decodedJpeg, 
Int32 quality, Stream outStream)
   at ImageTools.IO.Jpeg.JpegEncoder.Encode(Image image, Stream stream)

I used .NET Reflector to determine that they are passing in 0 for quality, 
which fjcore will change to 1.

What version of the product are you using? On what operating system?

ImageTools 0.1: 
http://imagetools.codeplex.com/Release/ProjectReleases.aspx?
ReleaseId=30309#DownloadId=75694
Not sure what version of fjcore they are using.
Win7 RC.

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 31 Jul 2009 at 10:33

RGBA Support

the only way to work with this in c# is with a wrapper to c libraries.

Microsoft doesn`t support this.

it would be great if fjcore support this.


Original issue reported on code.google.com by [email protected] on 8 Jul 2009 at 9:46

Attachments:

NuGet

Hi!

Thanks for this library. Would it be possible to host it on NuGet? I'm happy to 
help if you'd approve.

Looks like there's a clone here, too - also happy to do it through that channel 
instead.

What steps will reproduce the problem?
1. Searching here produces nothing: https://nuget.org/packages?q=fjcore

Original issue reported on code.google.com by [email protected] on 23 Mar 2013 at 4:37

Bug in color space conversion

Hi,

The color space conversion from YCbCr to RGB simply does not work 
(Image.ChangeColorSpace). The actual code is:

            else if (_cm.colorspace == ColorSpace.YCbCr && cs == 
ColorSpace.RGB)
            {
                for (int x = 0; x < width; x++)
                    for (int y = 0; y < height; y++)
                    {
                        ycbcr[0] = (byte)_raster[0][x, y]; // 0 is LUMA
                        ycbcr[1] = (byte)_raster[1][x, y]; // 1 is BLUE
                        ycbcr[2] = (byte)_raster[2][x, y];

                        YCbCr.fromRGB(rgb, ycbcr);
                        YCbCr.toRGB(ycbcr, rgb);

                        _raster[0][x, y] = ycbcr[0];
                        _raster[1][x, y] = ycbcr[1];
                        _raster[2][x, y] = ycbcr[2];
                    }

                _cm.colorspace = ColorSpace.RGB;
            }

I found two bugs:

1) The "FromRGB" call must be removed, since it will overwrite the YCbCr 
array data with converted values from the previous RGB pixel,

2) The final assignment to the _raster array takes its value from the 
ycbcr array. It should be read from the rgb array.

Also, it is possible to get a performance boost by avoiding to write the 
raster data to a temporary array, and read the converted values back after 
the conversion.

The trick is to rewrite the "toRGB" and  "fromRGB" to accept three "by-
ref" byte values, one for each component. So, the _raster value could be 
read/written directly without the use of a temporary array.

Also, the two conversion routines could be rewritten in a more optimized 
way by converting the byte type to the floating point type only once (and 
in "ToRGB", by substracting 128 from chroma components only once also, 
this is why I appended a "2" to the variable names: Cb2, Cr2)

So, here's my new version:

    internal class YCbCr 
    {
        public static void toRGB(ref byte c1, ref byte c2, ref byte c3)
        {
            double dY   = (double)c1;
            double dCb2 = (double)c2 - 128;
            double dCr2 = (double)c3 - 128;

            c1 = (byte)Math.Max(0, Math.Min(255, (dY + 1.402   * dCr2)));
            c2 = (byte)Math.Max(0, Math.Min(255, (dY - 0.34414 * dCb2 - 
0.71414 * dCr2)));
            c3 = (byte)Math.Max(0, Math.Min(255, (dY + 1.772   * dCb2)));
        }

        public static void fromRGB(ref byte c1, ref byte c2, ref byte c3)
        {
            double dR = (double)c1;
            double dG = (double)c2;
            double dB = (double)c3;

            c1 = (byte)( 0.299   * dR + 0.587   * dG + 0.114   * dB);
            c2 = (byte)(-0.16874 * dR - 0.33126 * dG + 0.5     * dB + 128);
            c3 = (byte)( 0.5     * dR - 0.41869 * dG - 0.08131 * dB + 128);
        }
    }

The class still contains the (less-performant) "in-out array" version:

        public static void toRGB(byte[] colorIn, byte[] colorOut)
        {
            byte c1 = colorIn[0];
            byte c2 = colorIn[1];
            byte c3 = colorIn[2];

            toRGB(ref c1, ref c2, ref c3);

            colorOut[0] = c1;
            colorOut[1] = c2;
            colorOut[2] = c3;
        }

        public static void fromRGB(byte[] colorIn, byte[] colorOut)
        {
            byte c1 = colorIn[0];
            byte c2 = colorIn[1];
            byte c3 = colorIn[2];

            fromRGB(ref c1, ref c2, ref c3);

            colorOut[0] = c1;
            colorOut[1] = c2;
            colorOut[2] = c3;
        }

...but they exist only for future use, because now some parts of the 
ChangeColorSpace method can be rewritten to use the "ref byte" version:

            if (_cm.colorspace == ColorSpace.RGB && cs == ColorSpace.YCbCr)
            {
                for (int x = 0; x < width; x++)
                    for (int y = 0; y < height; y++)
                        YCbCr.fromRGB(ref _raster[0][x,y], 
                                      ref _raster[1][x,y], 
                                      ref _raster[2][x,y]);

                _cm.colorspace = ColorSpace.YCbCr;
            }
            else if (_cm.colorspace == ColorSpace.YCbCr && cs == 
ColorSpace.RGB)
            {
                for (int x = 0; x < width; x++)
                    for (int y = 0; y < height; y++)
                        YCbCr.toRGB(ref _raster[0][x,y], 
                                    ref _raster[1][x,y], 
                                    ref _raster[2][x,y]);

                _cm.colorspace = ColorSpace.RGB;
            }

Of course, I deleted the local ycbcr and rgb arrays since they are no 
longer used.

I attach the two files with this post.

I would greatly appreciate to be included as a member of this very cool 
project.

Original issue reported on code.google.com by [email protected] on 4 Dec 2008 at 5:53

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.