{"id":22343553,"url":"https://github.com/datajuggler/pixeldatabase","last_synced_at":"2025-09-02T12:39:12.085Z","repository":{"id":44989786,"uuid":"244227027","full_name":"DataJuggler/PixelDatabase","owner":"DataJuggler","description":"Nuget package DataJuggler.PixelDatabase allows you to manipulate images in a language I invented called Bitmap Query Language or BQL for short.","archived":false,"fork":false,"pushed_at":"2025-04-27T13:46:04.000Z","size":2034,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-07T05:58:58.235Z","etag":null,"topics":["csharp","graphics"],"latest_commit_sha":null,"homepage":"https://pixeldatabase.net","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataJuggler.png","metadata":{"files":{"readme":"README.md","changelog":"History.cs","contributing":null,"funding":null,"license":"License/License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-01T21:32:40.000Z","updated_at":"2025-04-27T13:46:08.000Z","dependencies_parsed_at":"2023-12-10T02:30:36.717Z","dependency_job_id":"29f556e2-9baa-4a9a-8780-ba612ff6207a","html_url":"https://github.com/DataJuggler/PixelDatabase","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DataJuggler/PixelDatabase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FPixelDatabase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FPixelDatabase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FPixelDatabase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FPixelDatabase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataJuggler","download_url":"https://codeload.github.com/DataJuggler/PixelDatabase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataJuggler%2FPixelDatabase/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267792755,"owners_count":24144931,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["csharp","graphics"],"created_at":"2024-12-04T08:16:22.514Z","updated_at":"2025-09-02T12:39:12.063Z","avatar_url":"https://github.com/DataJuggler.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PixelDatabase\n\n2.14.2025: System.Drawing.Common library was updated to 9.0.2.\n\n11.22.2024: This project has been updated to .NET 9.\n\n11.5.2024: I fixed a bug where the CreateNew was not setting the background image. This was\ncaused by when I added a default Criteria of Alpha \u003e 0 so most queries only affect the visible part of an image.\nThis also fixes the Show query.\n\n    // Simple Show query, will set the alpha value to 255 for all pixels\n    string query = \"Show\";\"\n\n\t// Update\n\tPixelQuery pixelQuery = pixelDatabase.ApplyQuery(query, null);\n\n\t// test the results\n\tint pixelUpdated = pixelQuery.PixelsUpdated;\n\n11.3.2024: I added a new method to PixelDatabase called CreateNew. This creates a new \nBitmap and loads a pixeldatabase for the Width and Height givne.\nI also added a new DrawLine method to simplify Line drawing.\n\n7.24.2024: RandomShuffler and UltimateHelper were updated.\nI also added a new method Clone, whiich creates a copy of a PixelDatase. Untested.\n\n2.28.2024: I moved the Title of each calendar up 8 pixels. \n\n2.27.2024: I now draw a line between Header and Day Roy Image. If no Day Row Image, it is still a horizontal line\n1 vertical pixel below the header.\n\n2.26.2024: I changed NuGet PixelDatabase.CreateCalendar to accept a BaseFont and a HeaderFont. It is a breaking\nchange, but I figure now is the time to break this method since it is new.\nAlso added an optional parameter as of a pixel database for the day row image. This is the row where the\nday names are abbreviated.\n\n2.23.2024: I added a new method to PixelDatabase - CreateCalendar, which takes in an argument for a Month and a Year.\nView the demo project here: https://github.com/DataJuggler/CalendarCreator\n\n2.16.2024: PixelDatabase.DrawLine and DrawRepeatingLine were updated. A Bitmap is now returned from the methods, so you can \nget the updates that were applied. \n\n12.7.2023: New Properties - MaxBlueDifference, MaxGreenDifference, MaxRedDifference. This allows you to query on \npositive numbers, verse RedMaxDifference made you work with negative numbers and it is a little unnatural feeling.\n\n11.22.2023: UltimateHelper was updated.\n\n11.18.2023\nVersion 8.0.0: This project has been updated to .NET Core 8.0.0.\n\n7.5.2023: I added a Rescale image, which returns the dimensions for a new image by passing in a\nMaxWidth and MaxHeight value, and the code determins the ratio by taking the lowest of ratio x\nand ratio y. To actually resize the image, call Resize. I am using this new method in \nDataJuggler.BlazorGallery project for the FullScreenImageViewer component.\nLive sample (https://blazorgallery.com).\n\n4.24.2023: I found a better method of resizing an image, and wrote a new Resize method that returns\na loaded PixelDatabase at the new size.\n\nUpdate 4.23.2023:\nThe current version is 7.0.7. I added a Resize method which returns a PixelDatabase loaded with the new size.\nThere was already a ResizeImage, but this method makes it easier for use with PixelDatabase.\n\nPixelDatabase.Net is now live: \nhttps://pixeldatabase.net\nA Free Online Text Based Image Editor\n\nI am starting a batch version of this project now because I need it for videos.\n\nPlease visit my YouTube channel, as I make videos for PixelDatabase.Net as often as I can:\nhttps://www.youtube.com/channel/DataJuggler\n\nThis class library and Nuget package was built as part of my project TransparencyMaker. I created this library so I can build a Blazor version for a domain I just bought today called PixelDatabase.\n\nThe documentation below is copied from Transparency Maker.\n\nHere is the link to TransparencyMaker:\n\nhttps://github.com/DataJuggler/TransparencyMaker\n\nMost of this is applicable to this project now that it has been ported to a class library, I just copied and pasted for now to save time.\nI apologize in advance, but this is better than none.\n\n# Motivation\nThe reason I wrote Transparency Maker originally is when I purchase stock photos, almost all come with a background color and often I need a transparent background. There are other tools that perform background removal, with more now than in 2012 when I started working on Transparency Maker, however I wanted a way to programmaticaly manipulate pixels.\n\n# Rebranding the name to Pixel Database (done for the Nuget package)\nThe original purpose of Transparency Maker was to make backgrounds transparent, thus the name. I have now expanded the features to include updating pixels, changing colors, etc. \n\nI am continuing testing, the rest of these docs use caution some are specific to the Windows Form app, and some are in the class library / Nuget package DataJuggler.PixelDatabase.\n\nAll the functionality that can be done in TransparencyMaker can be done in PixelDatabase, except for Set Background Color, that is specific to Transparency Maker. Updated documenation coming soon.\n\n# Visual Studio \nVisual Studio 2019 is required, version 16.4+.\n\n# Transparency Maker Videos on my Channel (new videos coming as soon as today)\n\nhttps://www.youtube.com/playlist?list=PLKrW5tXCPiX2PxrLPszDzlcEZwQG-Qb8r\n\nI just updated my channel to be split into more play lists to separate each section.\n\n# How PixelDatabase Works\nThe first thing that happens when an image is opened, is your file is parsed into a list of PixelInformation objects, aka Pixel Database.\n\nWhen the program starts, click the Start button to select your image. The image must be a Png or a Jpg.\n\n\u003cimg src=\"https://github.com/DataJuggler/TransparencyMaker/blob/master/Docs/ScreenShot.png\"\u003e\n\nA Pixel Database is a List of PixelInformation objects that contain properties about the pixel. To find the pixel information for any pixel, turn the Color Picker on.\n\n\u003cimg src=\"https://github.com/DataJuggler/TransparencyMaker/blob/master/Docs/ColorPicker.png\"\u003e\n\nTip: To determiine if the Color Picker is on, hover your mouse of any part of your image. If the mouse cursor turns into a pointer (a hand), then the Color Picker is on. \n\nOnce the Color Picker is turned on, click any pixel in your image and a Pixel Information Box pops up:\n\n\u003cimg src=\"https://github.com/DataJuggler/TransparencyMaker/blob/master/Docs/PixelInfoBox.png\"\u003e\n\nThe box contains the following properties:\n\n# Red\nThe Red value of RGB value. Value range is 0 - 255.\n\n# Green\nThe Green value of RGB value. Value range is 0 - 255.\n\n# Blue\nThe Blue value of RGB value. Value range is 0 - 255.\n\n# Alpha\nThe Transparency Level of the pixel. Values are 0 - 255, where 0 is transparent and 255 is visible.\n\n# X\nThe horizontal position of the pixel clicked. \n\n# GreenRed\nThe sum of Green plus Red.\n\n# BlueGreen\nThe sum of Blue plus Green.\n\n# BlueRed\nThe sum of Blue plus Red.\n\n# Total\nThe sum of Red plus Green plus Blue.\n\n# Y\nThe vertical position of the pixel clicked.\n\nYou can use all of the above values in your queries to manipulate your image.\n\n# BQL - Bitmap Query Language\n\n# Why BQL?\nThis application started out as a plain Windows Form that I would hard code C# statements to replace the background of stock photos with transparent backgrounds. Over time I switched to a more object oriented approach where I analyze the entire image, and thus the Pixel Database was created.\n\nThe initial criticism I have received is there are not any controls like most graphic programs. If that is what everyone still wants I am open to ideas about what types of controls are needed. I created BQL because it is similar to SQL that many C# developers already know, thus enabling them to get up to speed quickly. Another reason I created BQL instead of a control based graphical UI is time to develop. Many of my failed endeavors have involved very complicated UI's, and then I am reminded of this small company called Google that started with a webpage that contained a single textbox and a button. \n\n# Hide / Show vs Update Queries\n\nThere are two types of queries; Hide/Show and Update.\n\n# Hide / Show\n\n# Hide\nAny pixels affected by the query will be set to Alpha 0, which makes them invisible.\n\n# Example\nHide Pixels Where  \nTotal \u003e 700\n\n# Shortcut: Hide\nHide Pixels Where can be shortened to:\n\nHide\u003cbr/\u003e\nTotal \u003e 700 \n\n# Show\nAny pixels affected by the query will be set to Alpha 255, which makes them visible.\n\n# Example\nShow Pixels Where  \nRed \u003c 200\n\n# Shortcut: Show\nShow Pixels Where can be shortened to:\n\nShow\u003cbr/\u003e\nRed \u003c 200\n\n# Important\nThis query parser may be rewritten to be more robust someday, but for now certain attributes must be on their own line.\nI wrote the query parser in a few hours many years ago, and it works pretty well so I have not bothered to refactor it (yet).\n\nSo the query above would fail if written like this\n\n# Invalid\nShow X \u003c 150\n\n# Correct\nShow\u003cbr/\u003e\nX \u003c 150\n\nIt wouldn't be that hard to rewrite the query parser, so let me know if you think the line by line requirement is confusing. I know it is crude, but this app was designed to be quick, dirty and functional at first.\n\n# Operators\n\n# Equals\n# Equals Symbol: =\nWill match criteria on exact values.\n\n# Equal Example: \n\nHide\u003cbr/\u003e\nRed = 233\n\nAll pixels that have a Red value of 233 will be set to Alpha 0 to be hidden.\n\n# Greater Than\n# Greater Than Symbol: \u003e\n\nWill match criterian on greater than or equal to\n\n# Greater Than Example\n\nShow\u003cbr/\u003e\nY \u003e 1200\n\nAll pixels with a Y value of 1,200 or higher wil be set to Alpha 255 to be shown.\n\n# Less Than\n# Less Than Symbol: \u003c\n\nWill match criteria on less than or equal to\n\n# Less Than Example\n\nHide\u003cbr/\u003e\nBlueGreen \u003c 300\n\nAll pixels with a BlueGreen value of 300 or less wil be set to Alpha 0 to be hidden.\n\n# Between\n\nWill match criteria that is greater than or equal to the first number and less than or equal to the second number.\n\n# Between Example\n\nHide\u003cbr/\u003e\nBlue Between 200 255\n\nAll pixels with a Blue value between 200 and 255 will be hidden.\n\n\n# Compound Statements\n\nYou can combine criteria to further narrow down the pixels that are manipulated\n\n# Important: Each criteria must be on its own line.\n\n# Update Queries\nUpdate queries are very similar to Hide queries, except that you must include a Color attribute\n\n# Set Color\nThere are two ways to set a color, Named Colors or RGB values.\n\n# Named Color\nYou can set a pixel to a named color\n\nNote: For a list of Dot Net Colors see System.Drawing.Colors or this website lists them:\nhttp://www.flounder.com/csharp_color_table.htm \n\n# Named Color Example\n\nUpdate\u003cbr/\u003e\nSet Color FireRed\u003cbr/\u003e\nWhere\u003cbr/\u003e\nTotal Between 125 150\u003cbr/\u003e\n\n# Note: Where must be on its own line for Update queries\n\n# RGB Color\nYou set the color by specifying the Red, Green and Blue values\n\n# RGB Color Example\n\nUpdate\u003cbr/\u003e\nSet Color 121 220 7\u003cbr/\u003e\nWhere\u003cbr/\u003e\nY \u003e 100\u003cbr/\u003e\n\n# Where is not optional\n\nYou must specify the Where, even if you want to update all pixels\n\nUpdate\u003cbr/\u003e\nSet Color White\u003cbr/\u003e\nWhere\u003cbr/\u003e\nTotal \u003e 0\u003cbr/\u003e\n\n# Note: In the above example, all pixels will be set to white, since greater than \u003e is equal to \u003e or equal to.\n\n# New Feature: 2.22.2020 - Added Adjust color feature\n\nThe adjust color feature lets you adjust 1 color (Red, Green or Blue) or all colors by a certain amount.\n\nExample: \nUpdate\nSet Adjust Red 25\nWhere\nTotal \u003e 0 \n\n# Negative Color Example\n\nThe Adjustment value can also be negative.\n\nUpdate\nSet Adjust All -15\nWhere\nTotal \u003e 0 \n\nAll pixels will be adjusted by 15, so Red = 33, will become red = 18.\n\nIt is safe to apply a value as if a color channel of a pixel goes over 255 the value will be 255, or below 0 will be 0.\n\n# New Feature 2.23.2020: Swap (color)\n\nI added a new useful feature called Swap, that let you replace the value of Red With Blue, Red With Green or Green With Blue, and of course the opposite of swap is the same; green to blue is the same as blue to green.\n\n# Swap Example:\n\nUpdate\nSet Swap Red Blue\nWhere\nTotal \u003e 0\n\nThe above query will replace the value of Pixel.Red with Pixel.Blue for all pixels in the image (again greater than \u003e is the same as greater than or equal in BQL.\n\nSwap is safe to use, in terms of if you have a pixel with a vlue of blue 30, and you subtract 50, the resulting value of blue will be zero, not -20. The same is true for adding over the max value of a color (255), the value will be set to 255.\nOne problem with swap and values going out of bounds is the contrast created by slight variances give an image a different look, compared to all pixels being the same color. Some information in your image will be lost if you go below zero or above the maximum for many pixels.\n\n# New Feature 2.23.2020: Masks\n\nMasks is something I have thought about for a long time. Today I worked on a sample and some unwanted pixels kept getting modified with my query, so I got motivated and created a new property to the PixelInformationObject called Mask.\n\nMask Rules (This is the my guide for programming them, and is created as I code this).\n\nMasks will stay on after being created until you load a new image, remove the mask, clear all masks or close the program.\n\nMasks only affect Update queries for now. Hide Pixel and Show Pixel and draw line queries are not getting this feature (yet). If it works well I may apply it to the other areas later.\n\n# Mask Specification\n\nSet Mask Verb Name\n\n# Verbs \n\nVerbs are actions that can be performed to create, add, remove or replace masks.\n\n# Add\n\nAdd a mask and give it a name.\n\nExample: Set Mask Add Interior\n\n# Replace\n\nReplacing a mask removes all pixels affected by a mask, then creates a new mask for the pixels affected.\nExample: Set Mask Replace Mailbox\n\nIf any pixels had a Mask applied named Mailbox, they would be removed, and then a new mask named Mask Mailbox is created for the pixels affected in the update query.\n\n# Clear\n\nRemove a mask by name.\n\nExample: Set Mask Clear Fence.\n\n# Clear (All)\n\nTo remove all masks, pass in the name All.\n\nSet Mask Clear All\n\nNote: Clear and Clear All may require you to still pass in a valid where clause.\nIf yes, You can use:\n\nUpdate\nSet Mask Clear Curb\nWhere\nTotal \u003e 0\n\nWhen I start testing this I will try and document what is actually expected, and if possible I would like to get rid of the required Where clause. It should mean everything from the Select like SQL. \n\n# Disabling a Mask\n\nIf you want to keep a mask on an image, but want to run another query where the mask isn't active (disabled), you can run this.\n\nSet Mask Disable Bookshelf\n\nTo enable the query again:\n\nSet Mask Enable Bookshelf.\n\n# Hiding / Showing a Mask\nBy default, Masks are not visible, but a query to show them is as simple:\n\nShow A Mask:\n\nUpdate\nSet Mask Show Name\n\nHide A Mask:\n\nUpdate\nSet Mask Hide Name\n\n# Set Mask Color\n\nBy default, Masks are displayed in White. You can change this by setting the MaskColor property.\n\nSet MaskColor Color Name\n\nColor must be a .Net Named Color. If you are not sure, use the small box of Crayon colors like Red, Blue, Orange, etc.\nName is the name of the Masque to set the MaskColor. \n\nExample:\nSet MaskColor Turquoise PianoKeys\n\nNote: You must set the MaskColor property prior to showing the Mask.\n\n# Masks Are Being Developed Now\nI needed to write this somewhere to code it, and by writing it here first I don't have to come back and write it again.\n\n\n\n\n\n\n \n\n\n\n# Normalizing An Image\nOne of the uses of Transparency Maker is an image that is grainy or pixelated, you can smooth out an area by\nsetting all pixels in a range to a certain value.\n\nUpdate\u003cbr/\u003e\nSet Color 220 0 55\u003cbr/\u003e\nWhere\u003cbr/\u003e\nTotal Between 525 590\u003cbr/\u003e\nX Between 200 360\u003cbr/\u003e\nY \u003e 400\u003cbr/\u003e\n\n# Drawing Transparent Lines\n\nTo Draw a Transparent Line, Type The Following\n\nLine 1: Draw Line LineThickness\u003cbr/\u003e\nLine 2: First two points are Line Start Point X Y\u003cbr/\u003e\n        Second two points are Line End Point X Y\u003cbr/\u003e\nLine 3 (Optional): Repeat Direction Iterations Move\u003cbr/\u003e\n\nDraw Line 4\u003cbr/\u003e\n161  125  457  66\u003cbr/\u003e\nRepeat Down 15 1\u003cbr/\u003e\n\n# Tip: Line 2 can be filled in for you using the Color Picker\n\nType Line 1 Draw Line (Thickness), then hit enter to place your cursor on the next line.\nEnsuriing the Color Picker is toggled on, Click on your image to establish Point 1:\n\nDraw Line 4\u003cbr/\u003e\n161  125  \n\nThen click your mouse again for the end point of the line:\n\nDraw Line 4\u003cbr/\u003e\n161  125  457  66\n\n(Optional) Type line 3 if you want to repeat.\n\nThen click Apply.\n\nDraw Line 4\u003cbr/\u003e\n161  125  457  66\u003cbr/\u003e\nRepeat Down 15 1\u003cbr/\u003e\n\n# Repeat Directions\nUse with Repeat with Down, Up, Left and Right\n\n# Repeat Up Example\n\nDraw Line 2\u003cbr/\u003e\n0  64  457  66\u003cbr/\u003e\nRepeat Up 100 2\u003cbr/\u003e\n\nThe above line will be drawn 100 times, and each time it will move the Y coordinate up (minus) two pixels.\n\nNote: The line will go futher than the bounds of the image, so Repeat 50 would accomplish the same thing.\n\n# Repeat Left Example\n\nDraw Line 1\u003cbr/\u003e\n225  412  105  430\u003cbr/\u003e\nRepeat Left 25 2\u003cbr/\u003e\n\nThe above line will be drawn 25 times and will move the StartPoint.X and EndPoint.X left two pixels each iteration.\n\n# Repeat Right Example\n\nDraw Line 5\u003cbr/\u003e\n140 300 90 600\u003cbr/\u003e\nRepeat Right 50 10\u003cbr/\u003e\n\nThe above line will draw transparent stripes through an image because the Repeat Move (last parameter) is greater than the line thickness from Line 1.\n\n# Draw Transparent Lines Are Slow In Large Images\nDrawing transparent lines is slower than any other operation using Transparency Maker because what it actually does is create a copy of the source image and draws a line trhough the copy in a color that doesn't exist in the copy, then creates a Pixel Database out of the copy image and determines which pixels were modified. The pixels that were modified in the copy are then applied to the source Pixel Database and set to Transparent.\n\nI think this is a good candidate for letting people with a powerful GPU take advantage of this, but I haven't learned how to apply this yet. I have a 1080 TI, but I have never written any code to take advantage of a GPU. Volunteers anyone?\n\n# Masks\n\n\n\n# Known Issues\nClicking Save sometimes causes an error. You can think click Continue, and are returned to your image.\nClick Save As works.\n\n# Upcoming Features\nIt has been on my list for a long time to add a Save prompt if there are changes and you attempt to close the file or the application.\n\nLet me know what features you think are needed or any feedback you may have.\n\n# Draw Line In Color\nI thought I had code to draw a line in a specific color, but this has not been done yet apparently. It will be coming soon.\n\nIf anyone wants this feature let me know.\n\nAny suggestions or feedback is welcome.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatajuggler%2Fpixeldatabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatajuggler%2Fpixeldatabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatajuggler%2Fpixeldatabase/lists"}