georg-jung / mozjpegsharp Goto Github PK
View Code? Open in Web Editor NEWThis project forked from quamotion/as.turbojpegwrapper
MozJPEG wrapper for .Net
License: MIT License
This project forked from quamotion/as.turbojpegwrapper
MozJPEG wrapper for .Net
License: MIT License
Using your own code, you could make a very useful application. It shoud be given a path and it shoul iterate over all files in tis directory and the sub direcories. It should do the safest thing i.e. make the jpg smaller such that is pixel by pixel identical. When a jpg is found, let mozjpeg create something like jpg.tmp. If this file is smaller, the original file can be overwritten by the contents of jpg.tmp. Either way, jpg.tmp shpuld be deleted afterwards. This is better than deleting the original file and then renaming jpg.tmp since it will cause fragmentation. Most jpg files from your smartcam can be reduced by 6% or so and most people have folders with lots of jpeg files.
Best regards,
Fredrik
The sample code provided on the code page https://github.com/georg-jung/MozJpegSharp no longer compiles.
This line
var compressed = tjc.Compress(bmp, MozJpegSharp.TJSubsamplingOption.Chrominance420, 75, MozJpegSharp.TJFlags.None);
reports:
Severity Code Description Project File Line Suppression State
Error CS1501 No overload for method 'Compress' takes 4 arguments
Can you provide an updated base sample please :)
Hi there,
I'm hoping this is a very silly question and I've missed something basic, but I was running through the code and spotted this:
I was expecting this to be "mozjpeg" as opposed to the "turbojpeg" in Quamotion.TurboJpegWrapper.
I assume you're shipping the MozJpeg dll with nuget but just never renamed this in code / the nuget package generation steps?
This call tjc.Compress(bmp, MozJpegSharp.TJSubsamplingOption.Chrominance420, 75, MozJpegSharp.TJFlags.None);
Is giving an exception
Provided pixel format "8207" is not supported
Is there anything I can do to shrink these? Squoosh will shrink them fine.
Thanks
I am running into pixilation issue when using MozJpegSharp from within docker deployment via standard MS template which is Debian.
When running compression from within VS on windows - results are good. However after deploying the same code to Docker, compressing any image appears to cause fairly noticeable pixilation.
I've tried changing parameters, but the results are the same.
Any suggestions appreciated.
Encoding with (F#):
let writeMozJpg (img:System.Drawing.Image) path =
async {
use bmp = new System.Drawing.Bitmap(img)
use tjc = new MozJpegSharp.TJCompressor();
let compressedBytes = tjc.Compress(bmp, MozJpegSharp.TJSubsamplingOption.Chrominance420, 75, MozJpegSharp.TJFlags.AccurateDct)
if compressedBytes.Length > 0 then
use file = File.Create(path)
do! file.AsyncWrite(compressedBytes,0,compressedBytes.Length)
file.Close()
return (true, path)
else
return (false, String.Empty)
}
Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:5.0
EXPOSE 8181
RUN apt update
RUN apt install -y libgdiplus
RUN apt install -y libturbojpeg0
COPY bin/Release/net5.0/publish/ App/
WORKDIR /App
ENTRYPOINT ["dotnet", "matter.App.dll", "appsettings.json"]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.