media:cpp --transform 1/3
This commit is contained in:
parent
04a7bd1da4
commit
570e16eaa4
BIN
packages/media/cpp/dist/pm-image.exe
vendored
BIN
packages/media/cpp/dist/pm-image.exe
vendored
Binary file not shown.
BIN
packages/media/cpp/dist/pm-image.pdb
vendored
BIN
packages/media/cpp/dist/pm-image.pdb
vendored
Binary file not shown.
@ -119,7 +119,7 @@ static TransformResult call_gemini(
|
||||
std::string mime = mime_from_ext(fs::path(input_path).extension().string());
|
||||
std::string b64 = base64_encode(img_bytes.data(), img_bytes.size());
|
||||
|
||||
// Build request JSON
|
||||
// Build request JSON (Gemini 3 REST API)
|
||||
json req_body = {
|
||||
{"contents", json::array({
|
||||
{{"parts", json::array({
|
||||
@ -133,7 +133,7 @@ static TransformResult call_gemini(
|
||||
};
|
||||
|
||||
std::string url = "https://generativelanguage.googleapis.com/v1beta/models/"
|
||||
+ opts.model + ":generateContent?key=" + opts.api_key;
|
||||
+ opts.model + ":generateContent";
|
||||
|
||||
std::string body_str = req_body.dump();
|
||||
|
||||
@ -150,6 +150,8 @@ static TransformResult call_gemini(
|
||||
std::string response_str;
|
||||
struct curl_slist* headers = nullptr;
|
||||
headers = curl_slist_append(headers, "Content-Type: application/json");
|
||||
std::string auth_header = "x-goog-api-key: " + opts.api_key;
|
||||
headers = curl_slist_append(headers, auth_header.c_str());
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
|
||||
@ -151,7 +151,7 @@ int main(int argc, char **argv) {
|
||||
std::string tf_output;
|
||||
std::string tf_prompt;
|
||||
std::string tf_provider = "google";
|
||||
std::string tf_model = "gemini-2.0-flash-exp";
|
||||
std::string tf_model = "gemini-3-pro-image-preview";
|
||||
std::string tf_api_key;
|
||||
|
||||
auto *transform_cmd = app.add_subcommand("transform", "AI image editing (Gemini / Google)");
|
||||
@ -159,7 +159,7 @@ int main(int argc, char **argv) {
|
||||
transform_cmd->add_option("output", tf_output, "Output path (omit = auto from input + prompt)");
|
||||
transform_cmd->add_option("-p,--prompt", tf_prompt, "Editing prompt")->required(true);
|
||||
transform_cmd->add_option("--provider", tf_provider, "AI provider (google)")->default_val("google");
|
||||
transform_cmd->add_option("--model", tf_model, "Model name")->default_val("gemini-2.0-flash-exp");
|
||||
transform_cmd->add_option("--model", tf_model, "Model name")->default_val("gemini-3-pro-image-preview");
|
||||
transform_cmd->add_option("--api-key", tf_api_key, "API key (or set IMAGE_TRANSFORM_GOOGLE_API_KEY env)");
|
||||
|
||||
// ── serve ───────────────────────────────────────────────────────────
|
||||
|
||||
@ -25,10 +25,17 @@
|
||||
#define IDC_CHK_AUTOROT 608
|
||||
#define IDC_CHK_STRIP 609
|
||||
|
||||
// AI Transform dialog controls
|
||||
#define IDD_TRANSFORM_PROMPT 700
|
||||
#define IDC_EDIT_PROMPT 701
|
||||
#define IDC_STATIC_PROMPT_LABEL 702
|
||||
|
||||
// User messages
|
||||
#define UWM_QUEUE_PROGRESS (WM_USER + 100)
|
||||
#define UWM_QUEUE_DONE (WM_USER + 101)
|
||||
#define UWM_IMAGELOADED (WM_USER + 102)
|
||||
#define UWM_QUEUE_ITEM_CLICKED (WM_USER + 103)
|
||||
#define UWM_TRANSFORM_PROGRESS (WM_USER + 104)
|
||||
#define UWM_TRANSFORM_DONE (WM_USER + 105)
|
||||
|
||||
#endif // PM_UI_RESOURCE_H
|
||||
|
||||
@ -74,6 +74,29 @@
|
||||
</Command.LabelTitle>
|
||||
</Command>
|
||||
|
||||
<!-- AI Transform tab -->
|
||||
<Command Name="cmdTabAI" Id="410">
|
||||
<Command.LabelTitle>
|
||||
<String Id="4101">AI Transform</String>
|
||||
</Command.LabelTitle>
|
||||
</Command>
|
||||
<Command Name="cmdGroupTransform" Id="411">
|
||||
<Command.LabelTitle>
|
||||
<String Id="4111">Transform</String>
|
||||
</Command.LabelTitle>
|
||||
</Command>
|
||||
<Command Name="cmdTransform" Symbol="IDC_CMD_TRANSFORM" Id="310">
|
||||
<Command.LabelTitle>
|
||||
<String Id="3101">Transform</String>
|
||||
</Command.LabelTitle>
|
||||
<Command.LargeImages>
|
||||
<Image Id="3102">res/TransformL.bmp</Image>
|
||||
</Command.LargeImages>
|
||||
<Command.SmallImages>
|
||||
<Image Id="3103">res/TransformS.bmp</Image>
|
||||
</Command.SmallImages>
|
||||
</Command>
|
||||
|
||||
<!-- Misc -->
|
||||
<Command Name="cmdAppMenu" Id="710" />
|
||||
<Command Name="cmdHelp" Symbol="IDC_RIBBONHELP" Id="700" />
|
||||
@ -121,6 +144,19 @@
|
||||
<Button CommandName="cmdResize" />
|
||||
</Group>
|
||||
</Tab>
|
||||
<Tab CommandName="cmdTabAI">
|
||||
<Tab.ScalingPolicy>
|
||||
<ScalingPolicy>
|
||||
<ScalingPolicy.IdealSizes>
|
||||
<Scale Group="cmdGroupTransform" Size="Large" />
|
||||
</ScalingPolicy.IdealSizes>
|
||||
<Scale Group="cmdGroupTransform" Size="Popup" />
|
||||
</ScalingPolicy>
|
||||
</Tab.ScalingPolicy>
|
||||
<Group CommandName="cmdGroupTransform" SizeDefinition="OneButton">
|
||||
<Button CommandName="cmdTransform" />
|
||||
</Group>
|
||||
</Tab>
|
||||
</Ribbon.Tabs>
|
||||
|
||||
<Ribbon.HelpButton>
|
||||
|
||||
@ -42,4 +42,8 @@ Convert-PngToBmp "$resDir\16x16_0300\cross.png" "$resDir\ClearS.bmp" 16
|
||||
# Resize -> arrow_out.png
|
||||
Convert-PngToBmp "$resDir\32x32_0060\arrow_out.png" "$resDir\ResizeL.bmp" 32
|
||||
|
||||
# AI Transform -> paintbrush.png
|
||||
Convert-PngToBmp "$resDir\32x32_0700\paintcan.png" "$resDir\TransformL.bmp" 32
|
||||
Convert-PngToBmp "$resDir\16x16_0700\paintbrush.png" "$resDir\TransformS.bmp" 16
|
||||
|
||||
Write-Output "Done."
|
||||
|
||||
BIN
packages/media/cpp/src/win/ui_next/res/TransformL.bmp
Normal file
BIN
packages/media/cpp/src/win/ui_next/res/TransformL.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
BIN
packages/media/cpp/src/win/ui_next/res/TransformS.bmp
Normal file
BIN
packages/media/cpp/src/win/ui_next/res/TransformS.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 300 KiB |
Loading…
Reference in New Issue
Block a user