Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Darkroom editor

Darkroom

Image handling made easy.

Client-side. Server-side.

Working with negatives

How-to load an image:

  // simple load
  var img = new Negative("sample.jpg");
  
  // load and resize -- if only height or width is specified, the image is scaled proportionally
  var img = new Negative("sample.jpg", 1280, 720);
  
  // load from Uri -- resize applies here as well
  var img = new Negative("http://host.domain/imageName.jpg");

Crop an image:

  var img = new Negative("sample.jpg", 1280, 720);
  
  // this results in removing the right side of the image, resulting in a square image
  img.Cut(0, 0, 720, 720);

Digitize an image:

  var img = new Negative("sample.jpg");
  
  File.WriteAllText("dataUri.base64", img.Digitize().ToString());
  
  // Output: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEA...

Convert back to an image (useful when recieving data server-side)

  var img = new Negative("sample.jpg");
  
  DataUri digital = img.Digitize();
  
  Negative convertedImg = digital.ToNegative();

Pixel-wise comparison:

  var img = new Negative("sample.jpg"),
      dupeImg = new Negative("sample.jpg");
  
  if(img == dupeImg)
  {
    // DO-STUFF
  }

Enter the darkroom with your negative

  static void Main(string[] args)
        {
            Stopwatch cropTimer = Stopwatch.StartNew();

            Negative img = new Negative("sample.jpg", 1280, 720)
                                       .Cut(560, 0, 720, 720);
            cropTimer.Stop();
            Console.WriteLine("Resized and cropped: {0} seconds", cropTimer.Elapsed.TotalSeconds);

            Stopwatch processingTimer = Stopwatch.StartNew();

            using (Darkroom editor = new Darkroom(img))
            {
                editor
                    .BlackAndWhite(BlackAndWhiteMode.Regular)
                    .Invert()
                    .Contrast(50)
                    .Brightness(10)
                    .Saturation(-50)
                    .Vibrance(-50)
                    .Gammma(-50)
                    .Noise(25)
                    .Sepia()
                    .Hue(45)
                    .Tint("#efefef")
                    // when the negative gets washed, all of the called filters get applied
                    .Wash()
                    .Develop(string.Format(@"{0}.jpg", Environment.TickCount));
            }

            processingTimer.Stop();

            Console.WriteLine("All image filters applied: {0} seconds", processingTimer.Elapsed.TotalSeconds);
            Console.ReadLine();
        }

About

Image handling made easy.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages