{"id":28190764,"url":"https://github.com/ztftrue/compress-image","last_synced_at":"2025-05-16T10:14:25.070Z","repository":{"id":59209549,"uuid":"449150375","full_name":"ZTFtrue/compress-image","owner":"ZTFtrue","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-12T07:52:40.000Z","size":6814,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-03-07T00:19:36.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZTFtrue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-18T05:18:25.000Z","updated_at":"2022-09-13T11:15:08.000Z","dependencies_parsed_at":"2022-09-17T00:51:08.303Z","dependency_job_id":null,"html_url":"https://github.com/ZTFtrue/compress-image","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTFtrue%2Fcompress-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTFtrue%2Fcompress-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTFtrue%2Fcompress-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTFtrue%2Fcompress-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZTFtrue","download_url":"https://codeload.github.com/ZTFtrue/compress-image/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509395,"owners_count":22082899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-16T10:13:39.470Z","updated_at":"2025-05-16T10:14:25.062Z","avatar_url":"https://github.com/ZTFtrue.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 有损图像压缩算法\n\nRun\n\n```sh\nmkdir build\ncd build\u0026\u0026cmake ../\u0026\u0026cmake --build .\u0026\u0026cd ..\u0026\u0026./build/OpenCV_learn\n```\n\n## 新增-\u003e破坏盲水印\n\n一般的盲水印就是加个高透明度图片(文字), 这个可以通过调整图片的gamma，RGB颜色值看到。\n\n```c++\nuncompressImage(); // 普通水印\n```\n\n```c++\n// \u003chttps://github.com/guofei9987/blind_watermark\u003e \nuncompressImageWaterMaker()//图片色彩艳丽，破坏就很严重\n```\n\n可能每个图片都需要调整参数。\n\n/assets/a,png 就是带有水印的图片。解码代码：\n\n```py\nfrom blind_watermark import WaterMark\nbwm1 = WaterMark(password_img=1, password_wm=1)\nwm_extract = bwm1.extract('output/embedded.png', wm_shape=191, mode='str')\nprint(wm_extract)\n```\n\n对于`blind_watermark` (应该)有更好(复杂)的解决算法\n\n附：\u003chttps://github.com/guofei9987/blind_watermark/issues/60\u003e\n\n\u003chttps://github.com/guofei9987/blind_watermark/issues/36\u003e\n\u003chttps://github.com/guofei9987/blind_watermark/issues/30\u003e\n、\n`blind_watermark` 特指\u003chttps://github.com/guofei9987/blind_watermark\u003e\n\n```c++\nsupperMark(); //阻止AI识别,也能阻止频域水印（内容变色，不一定需要画线）\n```\n\n## 算法\n\n删除每一个像素(24位)每个RGB值的最后一位(降低对比度).\n\n存储jpg文件更小, 因为jpg算法也做了一次处理, 也导致部分颜色完全不正常.\n\n## 结果\n\n测试图片(assets/b.jpg)![测试图片](assets/b.jpg)\n\n|压缩前|压缩后|\n|---|---|\n|179.1kb|29.4kb(jpg)|\n|179.1kb|120.3kb(webp,no loss)|\n|179.1kb|32.3kb(webp,100)|\n\n![example.png](image/example.png)\n\nB 原图, C 压缩后, C2 直接内存数据复原, uncompress 存储成 jpg 文件后再复原.\n\n## 缺陷\n\n1. 色域会有损失\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fztftrue%2Fcompress-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fztftrue%2Fcompress-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fztftrue%2Fcompress-image/lists"}